Palette drawing

Hello,

I have 100 MB of images that need to be kept in memory.

8 different colors (for up to 8 players) are used with 8 different RGB values (draw units).

Right now my options are

  1. create a new image on the fly modifying the Player Color of the base image : CPU consuming

  2. Create a copy for each Player Color 100 * 8 = 800 mb

I want to draw those images giving a palette parameter. Wouldn’t that be faster?

Is that possible with Swing?

Cheers

Mordan

I’m guessing you don’t always need all the images available, if you do then just preload them all.

Have 1 class that’s responsible for getting the recolored images. In the class keep some type of list(HashMap maybe) of the images you have loaded to act as your cache. If you have already loaded this image return your cached version. If you haven’t yet loaded it then load it, add it to your list and then return it.

yea that’s an idea.

caching the often used images brings some mixed advantages.

thx