Animation without need to redraw

Hi guys,
I have a small problem. I'm working on an emulator for game ROM's, and the part I'm working on right now create a bitmap (at least it is supposed to do so). I have 13 different palettes (each has 16 different colors, COLORREF format:
[code]struct _palette
COLORREF Colors[16];
} Pals[13];[/code]
) and a big BYTE array with the actual image. Each BYTE refers to one entry of the selected palette. For the final image, I need 13 bitmaps of the raw image (BYTE array), one with each palette. Until now, I just create 13 bitmaps and then use SetPixel() to draw the image 13 times with different palettes. Works fine, except the fact that the image has around 200,000 pixel. Therefore my application needs 3-4 second, just to draw the images.
I thought that there has to be a solution, that allows me to just draw the image once, and then make 12 copies with different colors. I tried to use Logical Palettes with AnimatePalette() (Yes, I used PC_RESERVED for my PALETTEENTRY colors), but it turned out that I have to redraw the image anyways.

So I ask you: Do you know a way how i can change the color of a bitmap without redrawing it?

(Here an example how my code looks like (not my actual code, I shortened it to the most necessary parts, I know that it doesn't work like it is shown here):
[code]void DrawBitmaps(void)
HDC hdc = [...];
HBITMAP Image = [...];
_palette Pals[13] = [...];
BYTE *RawImage = {...};
int width = [...],
height = [...], j = 0;
SelectObject(hdc, Image);

for(int i = 0 ; i < 13 ; i++)
for(int y = 0 ; y < height ; y++)
for(int x = 0 ; x < width ; x++)
SetPixel(hdc, x, y, Pals[i].Colors[RawImage[j++]]);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!