Board index » delphi » Arghh: How to force 12 colour palette in 16 colour environment.

Arghh: How to force 12 colour palette in 16 colour environment.

This is urgent and I'm out of my depth.  I'm displaying pictures that
look great when you are using a hi-colour display (they only use
around 8 colours), but when you force it down to 16 colours, windows
refuses to let go of the system colours.  I've looked into
SetSysPaletteUse and stuff like that, but it isn't working and I don't
know how to get it to work.

The code I'm using is

   TempDevContext := GetDC(Handle);
   Display.ImageName := PicBase + CurrentGFile.FileName;

   SetSystemPaletteUse(TempDevContext,SYSPAL_NOSTATIC);
   TempPalette :=
SelectPalette(TempDevContext,Display.Picture.Bitmap.Palette,False);
   UnrealizeObject(TempPalette);
   RealizePalette(TempDevContext);
   SendMessage(Handle,WM_SYSCOLORCHANGE,0,0);

I'm trying to

Display a picture that uses 8 colours in a 16 colour display (colours
in control panel set to 16), and have it use the optimized palette
created for the picture instead of the windows system colours.

Thanks hugely in advance for any replies, Michael.

 

Re:Arghh: How to force 12 colour palette in 16 colour environment.


Hello,

As far as I know, Windows ALWAYS reserves a number of colors for its use
(in menus, windows and stuff), making it impossible to change them. If I
remember correctly in 256 color setups Windows reserves 20 colors (the
so-called system colors) so in 16 color setups you probably won't have
any available colors.
Yor best bet may be to try reduce the image's color-depth to 16 colors,
the ones that Windows provides (try going to http://www.download.com to
find an image editor capable of it).

Hope this helps,

Carlos A. R. Azevedo

Quote
Michael Lee wrote:

> This is urgent and I'm out of my depth.  I'm displaying pictures that
> look great when you are using a hi-colour display (they only use
> around 8 colours), but when you force it down to 16 colours, windows
> refuses to let go of the system colours.  I've looked into
> SetSysPaletteUse and stuff like that, but it isn't working and I don't
> know how to get it to work.

> The code I'm using is

>    TempDevContext := GetDC(Handle);
>    Display.ImageName := PicBase + CurrentGFile.FileName;

>    SetSystemPaletteUse(TempDevContext,SYSPAL_NOSTATIC);
>    TempPalette :=
> SelectPalette(TempDevContext,Display.Picture.Bitmap.Palette,False);
>    UnrealizeObject(TempPalette);
>    RealizePalette(TempDevContext);
>    SendMessage(Handle,WM_SYSCOLORCHANGE,0,0);

> I'm trying to

> Display a picture that uses 8 colours in a 16 colour display (colours
> in control panel set to 16), and have it use the optimized palette
> created for the picture instead of the windows system colours.

> Thanks hugely in advance for any replies, Michael.

Re:Arghh: How to force 12 colour palette in 16 colour environment.


Quote
mi...@cleo.murdoch.edu.au (Michael Lee) wrote:
>I'm displaying pictures that
>look great when you are using a hi-colour display (they only use
>around 8 colours), but when you force it down to 16 colours, windows
>refuses to let go of the system colours.

Carlos is correct.  The only way to change the colors in a 16-color system
is to go reprogram the VGA palette registers which will, of course, make
all the other programs look wrong.

The ONLY mode with a programmable palette is 256 color.

-- Tim Roberts, t...@probo.com
   Providenza & Boekelheide, Inc.

Other Threads