views:

65

answers:

1

Is "color cycling" possible in GDI+ with WinForms? I'd like the modify one or more colors in the palette of an on screen surface so that whenever the surface is repainted, GDI+ will use the modified colors.

Rather than perform the transformation manually pixel-by-pixel, I hope to use GDI+'s capability to render surfaces using indexed colors. (8bpp indexed color?)

Is there a (fast) way to do this?

NOTE: I don't want to modify the colors globally throughout the application UI. Rather, I only need to cycle colors on one particular control surface.

+1  A: 

AFAIK, this is tied to 8bpp video mode (256 simultaneous colors from a palette of several million). Since almost nobody runs in that mode these days, you wouldn't be able to do hardware palette-based color cycling.

Depending upon what you're trying to do, there may be simple way to achieve this. Can you provide more detail?

Scott Smith
Although, i'm wondering if he had an 8-bit/indexed palette picture rendering onto his surface, could he just adjust its palette and repaint? Maybe that'd work?
Chris
Yes, the idea is that the picture will be 8-bit/indexed color with respect to GDI+, but finally rendered however GDI+ wishes. The idea being that I won't have to manually scan through each pixel to test/modify. I am relatively sure that the user won't need to be in an old video mode for this to work.
James
Say you have painted your image, then you modify the palette, and will redraw. Will you be able to do this smooth without flickering? Check the bottom at http://www.eggheadcafe.com/software/aspnet/32276284/synchronizing-onpaint-to.aspx for syncing to the vertical refresh.
Mikael Svenson