[comp.windows.ms] Windows and Palette-manipulation

bert@helix.nih.gov (Bert Tyler) (10/20/90)

> Matt> Here is a neat little app that displays pretty pictures using
> Matt> the palette and color cycling under Windows 3.0.  It requires
> Matt> protect mode.  Color cycling requires 256 colors (otherwise
> Matt> you just get a static picture).
>
> I noticed this about the WinFrac program posted earlier; why is it so
> difficult to do colour cycles in ega?  I can see where an ega might need
> to be full-screen, but the real FractInt has had EGA cycling for _years_.

The problem is that Windows is controlling the video, and an application
program can only manipulate the palette if Windows *lets* it manipulate
the palette.

Unfortunately, neither the "stock" EGA or VGA drivers that come with Windows
let you do this.  If you query Windows about the palette capability of
either of these devices, you get a returned FALSE:

    hDC = GetDC(NULL);
    iRasterCaps = GetDeviceCaps (hDC, RASTERCAPS);
    iHasPalette = (iRasterCaps & RC_PALETTE) ? TRUE : FALSE;

In fact, my friends with SuperVGA drivers tell me that none of their
16-color drivers support palette-manipulation, either.  Foo.

(If your 16-color driver *does* let you manipulate palettes, version
2.0 of Winfract will let you color-cycle in 16-color mode, although it's
not as pretty as 256-color cycling.  For one thing, we have to temporarily
switch all of the Windows System colors to black-and-white. For another, when
we color-cycle your Winfract image, your whole *screen* gets color-cycled,
including your other apps.  Finally, we have to revert to the "stock"
palette whenever we lose the focus to ensure that your other apps don't
get messed up.  Best we could do.)