About image processing, how fast is it?

Hello.

I have been trying to develop Java games for a while now and decided to join this great forum.

My first question is about image processing. I’m working on a small game engine and I’m trying to make a color changing feature. The question is, should I process a new image every time I draw an object, or should I make a new image for every object? If there are many objects on the screen with different images, I guess the processing will be pretty slow, but a new image for every object requires more memory. It would be better ofcourse if I only made a new image for those objects that don’t have the original color, but still… So how do you guys usually do these things?

I have also made an own method that recolors images, and it seems pretty fast. It uses geRGB and does a few bit operations. Do you think BufferedImageOp is still faster?

Forgive me if I’m not talking clearly enough, that’s probably because I’m from Finland. :slight_smile:

Thank you.

It depends on what you want your engine to be able to do.
If you just need a couple of color variations of each image, pre-generated images are (much) faster. But if you want to be able to fade images in run time, you can’t do that unless you’re willing to waste a lot of ram.
If you’re mostly just using a couple of color variations, but do rare fades, it might be worthwhile to pre-generate the most common colors, then do the rest in runtime.

Either way, I make sure to stress test me solution to make sure it runs fast enough and doesn’t use too much ram, even in worst case scenarios.