Click to See Complete Forum and Search --> : Palette animation question


meli-melo
November 8th, 2004, 02:45 PM
I want to write a program using Visual C++ 6 that displays different shapes in a window: filled dark and light grey rectangles and red circles. I want to animate the display: the dark rectangles becoming light and vice versa, this flipping occurring at each second. So the natural solution is to use palette animation.

So, I set the program to run in 256 color mode. Here’s how I’d like to do it: first, I create a palette where entry #100 is dark grey, and entry #101 is light grey (for example). Then, I draw my shapes: some rectangles will be drawn using index #100, and the other ones will be drawn using index #101. Then during animation, at an interval of 1 second, the RGB values of the entries #100 and #101 are swapped.

Now my question is: how can I use functions to draw rectangles and ellipse using a specific color index (referring to a palette entry) to specify the color, instead of using an RGB triplet?

Thanks in advance,
Marc Melillo