This site requires JavaScript, please enable it in your browser!
Greenfoot back
sp33dy
sp33dy wrote ...

2012/2/1

Messing about with Images

sp33dy sp33dy

2012/2/1

#
Hi, I'm contemplating writing a quick jigsaw puzzle app next. I know how to do it, but want to check. I see I can get hold of the awt bufferimage. If I use this to cut up a big picture image. Is that getAwtImage() method likely to be removed at some point?? I.E. I need to be able to take a large picture and chop up into iddle bits (using masking). Hopefully, it'll provide a simple library for chopping up bits and pieces for people. Any issues with me doing so?
davmac davmac

2012/2/2

#
There are no specific plans to remove the getAwtImage() method; on the other hand it does expose some fairly specific Java APIs, so if you can possibly get away without using it then I'd recommend that.
Builderboy2005 Builderboy2005

2012/2/2

#
There is an easy way to 'mask' out images using only GreenfootImage. If you want to cut out a 20x20 portion of a 100x100 image, simply create a 20x20 Greenfoot image, and then draw the 100x100 image onto the 20x20 image. The 20x20 image will naturally be cropped, and then you can draw the 20x20 image to wherever you need it. I do, of course, want getAwtImage() to remain in the methods available if only because most of my shadow code in Nightmare depends on it :P
sp33dy sp33dy

2012/2/2

#
Thanks builderboy. I'll have a play with GreenfootImage, but not convinced it'll allow me to do what I would like. I would like to be able to use a an irregular shaped mask. Using the AlphaComposite in AWT provides the function perfectly. I'll see what else I can do in GreefootImage.
Builderboy2005 Builderboy2005

2012/2/2

#
Ah yes AlphaComposite would indeed be the way to go for that functionality. And probably a bit faster than drawing images onto each other as well!
Omniscience Omniscience

2012/2/2

#
@Builderboy2005 I've seen your scenarios, and they're awesome! Could you, perhaps, have a look at my issue to do with Arrays? Really need some help! Cheers.
You need to login to post a reply.