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

2012/4/27

BufferedImages and hackyness in Greenfoot

Builderboy2005 Builderboy2005

2012/4/27

#
So I have been messing around with BufferedImageOps for things like color correction and brightness and contrast, and I had an idea to be able to implement them into Greenfoot. It would be kinda hacky, and rely on methods that technically shouldn't be available, but I thought I would just ask a couple of questions really quick. The WorldCanvas can be accessed by WorldHandler.getInstance().getWorldCanvas(); but this provides no direct way to edit the canvas itself, or at least none that I can see. After digging through the source, am I right in my conclusion that Greenfoot does not use any type of BufferedImage during it's painting of the world? Ideally I guess I would be able to find a BufferedImage that represents the current World Image, but I don't think it's going to be that simple. I am aware that using the WorldCanvas.pain() method, I can paint the world onto a Graphics, which in turn can be connected to a BufferedImage, but that requires drawing the world twice (once when I call the paint() method and once when Greenfoot renders normally) and that is a bit slow, hackey, and doesn't always behave properly. I guess my overall question would be if there is any way I can directly access the world Image (preferably as a BufferedImage) without having to resort to paint()ing the whole world again?
nccb nccb

2012/4/28

#
You can get the BufferedImage representing the World's image with public methods:
getWorld().getBackground().getAwtImage()
Or is that you want to add post-processing to the whole image, after the actors have been painted? Can you give a quick example of exactly what you want to be able to do?
Builderboy2005 Builderboy2005

2012/4/28

#
Yes, I am aiming to be able to apply post-processing effects to the world image after the Actors have been painted. The only current way I know of doing quick post-processing is through BufferedImageOps, but those require a BufferedImage to work on.
Builderboy2005 Builderboy2005

2012/4/30

#
So I assume this is mostly not possible without direct intervention in the Greenfoot source?
davmac davmac

2012/5/1

#
Yep, not possible, sorry.
You need to login to post a reply.