Quote:> I have a problem that when I change the screen resolution to 256 Colours
> to debug the application for that platform, the TImageList images get
> corrupted. When doing this a couple of times (going back and forward to
> 32Bit/16Bit and 256Colours) the images eventually end up as black
> silhouettes.
I don't think the images are corrupt. In 256 color mode, no one -- not
Microsoft, not Borland -- does anything to make sure you have the correct
palette.
In fairness, this is a "hard" problem. In 256 color mode, 20 colors are
reserved so an application only has (usually) 236 colors available to it. When
you change the window focus, often there is no way to display everything on the
screen in the 236 available colors. A single image can easily have hundreds or
thousands or colors in it.
When switching the Window focus, you need to process the WM_QueryNewPalette and
WM_PaletteChange messages. This method tries to make the foreground image look
best. Sometimes the background images can suffer image quality, but this is to
ensure the foreground image is displayed correctly.
Displaying multiple images on a screen is not an easy problem in 256 color mode.
Take a look at the Lab Report that shows how to create an "optimized" palette
for display of several pf24bit images in 256 color mode:
http://www.efg2.com/lab/graphics/colors/ShowDemoMany.htm
The easiest solution to this problem is to require high color or true color
displays modes -- then you can ignore all these palette complications.
efg
_________________________________
efg's Computer Lab: http://www.efg2.com/lab
Delphi Books: http://www.efg2.com/lab/TechBooks/Delphi.htm
Overland Park, KS USA