2

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.

James
  • 1,788
  • 4
  • 22
  • 28

1 Answers1

1

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
  • 3,900
  • 2
  • 31
  • 63
  • 1
    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 Feb 24 '10 at 05:37
  • 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 Feb 24 '10 at 07:12
  • 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 Feb 24 '10 at 07:55