Board index » delphi » TImage Colour Problems in 256 Colour Mode

TImage Colour Problems in 256 Colour Mode

Got a form with 4 images on it loaded from 4 different 256 colour
bitmaps. When I show the form on a display running 256 Colour Mode the
image colours are corrupted. When I run in 16bit High Colour they
display correctly.

Is there a restriction that the images need to use the same palette.
i.e. exactly the same 256 colours in all the bitmaps?  Or am I doing
something wrong/missing something?

Delphi2 BTW

Cheers, J

 

Re:TImage Colour Problems in 256 Colour Mode


Quote
John H wrote in message <35fe58a3.4146...@news.uk.ibm.com>...
>Got a form with 4 images on it loaded from 4 different 256 colour
>bitmaps. When I show the form on a display running 256 Colour Mode the
>image colours are corrupted. When I run in 16bit High Colour they
>display correctly.

>Is there a restriction that the images need to use the same palette.
>i.e. exactly the same 256 colours in all the bitmaps?  Or am I doing
>something wrong/missing something?

Believe it or not, this is exactly how Windows was designed!

In 256 color mode, there are usually only 236 colors available since
20 are reserved for use by Windows to display buttons, panels,
icons, etc.  Each Window can have a 256-color palette, but if
you put more than an image on a single window you can
have a problem.

With 8-bit images, you could easily have about 1000 colors with
four different images.  The choice of which colors to use is "hard"
so MS did the reasonable(?) thing:  nothing.  Your application must
decide which colors to use.  Palettes don't exist in high color
or true color, that's why you have no problem there.

I have code on the Palettes and Colors projects page in my Computer
Lab that creates a palette for pf24-bit bitmaps for display on a 256
color monitor.  The code is from an article in Microsoft Systems
Journal and should have worked for pf8bit bitmaps, but I didn't
bother debugging that problem since it worked for the bitmaps
I had (again pf24bit BMPs).  So I'm not sure the code can
help you directly, but it may get you started.

efg
_________________________________________
efg's Computer Lab:  http://infomaster.net/external/efg

Earl F. Glynn                 E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

Other Threads