TImageList Images get corrupt when changing screen resolution

TImageList Images get corrupt when changing screen resolution

Post by Tasso Kau » Thu, 03 Jun 1999 04:00:00



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.

Is there any way to prevent this from happening?

Tasso

 
 
 

TImageList Images get corrupt when changing screen resolution

Post by Earl F. Glyn » Thu, 03 Jun 1999 04:00:00



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

 
 
 

TImageList Images get corrupt when changing screen resolution

Post by Tasso Kau » Fri, 04 Jun 1999 04:00:00


Thanks for your reply

I do understand that the Windows 95 might not always use the best palette to display
the images in the variuos colour modes,  but I was surprised to find that Delphi
actually modifies the TImageList palettes so that eventually the images become
unusable and have to be re-imported.  This doesn't happen when using images in
Glyphs.

Anyway, thanks for the tip, I will have a look at the code for the ShowDemo to see
if optimsing the palette will solve this problem.

Tasso




> > 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

 
 
 

1. Screen coordinates change after changing screen resolution???

Hello,

I recently encounterd a strange problem.
I am developing an application that is to be run under 640 x 480 only.
If, for example, somebody starts Win 95 in 800x600, then changes the
screen resolution to 640x480, some forms don't start up in their right
position... (I am setting them to their right postion by giving in .left
and .top everytime the app is started).
It's just like the screen coordinates are changed???

2. SelectObject returns null

3. TImageList gets corrupted when form saved / loaded

4. GL_PACK_SKIP_PIXELS? what is it?

5. Changing screen resolution in full-screen programs?

6. plugins 2.0 version

7. Help please - 256 color image's palette gets corrupted

8. Getting current screen resolution

9. Getting screen resolution

10. Getting the current screen color resolution

11. Change screen resolution

12. Changing screen resolution, pixel doubling?