Board index » delphi » How to load high-color pics into a Delphi 3 image list at run time

How to load high-color pics into a Delphi 3 image list at run time

When I load 16-bit color (high color) images into a Delphi 3 image list,
the pictures display at a very low color depth (perhaps just 16-colors).
However, when I load the list at design time, the images appear in full
color.

My Windows display is set for high-color, and I am displaying the image
via an Timage component.

I need to be able to load these images in high-color from my HDD. I'd
appreciate any help.

Thanks, Derek Diaz, University of Florida
d...@ufl.edu

 

Re:How to load high-color pics into a Delphi 3 image list at run time


Quote
Vincent van Veen wrote in message <3659C0F4.4B20D...@psych.ufl.edu>...
>I need to be able to load these images in high-color from my HDD. I'd
>appreciate any help.

Are you operating in 256 color mode?  If so, your high color or true color
images don't have a palette, and windows doesn't try at all to give your
images a palette they need.

The easiest solution to this, is to make sure you're working in high color
or true color display modes.   If you must operate in 256 color mode,
you can get a palette by taking a look at the "Show Demo One"
(or "Show Demo Many") Lab Report:
www.efg2.com/lab/Graphics/Colors/ShowDemoOne.htm

efg
_________________________________
efg's Computer Lab:       www.efg2.com/lab

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

Re:How to load high-color pics into a Delphi 3 image list at run time


I encountered the same thing when loading a 16bit bitmap from a resource
into the imagelist.  Apparently, there are some problems with the
imagelist's adding procedures.  The way I got around it was by first loading
the bitmaps into a TBitmap object, then using the AddMasked method on the
imagelist:

procedure TfrmMainMenu.FillImageList;
var Bitmap: TBitmap;
begin
     Bitmap := TBitmap.Create;
     try
        with ImageList do
        begin
             Clear;
             Bitmap.LoadFromResourceName(hInstance, 'Facility');
             AddMasked(Bitmap, Bitmap.TransparentColor);
             Bitmap.LoadFromResourceName(hInstance, 'PackTables');
             AddMasked(Bitmap, Bitmap.TransparentColor);
        end;
     finally
            Bitmap.Free;
     end;
end;

In your case, change the LoadFromResourceName, to the LoadFromFile method,
and that should work.  If you don't want the background to be transparent,
use the Add method, instead of the AddMasked.  Hope this helps.

Ryan McGinty
OCERIS, Inc.

Quote
>When I load 16-bit color (high color) images into a Delphi 3 image list,
>the pictures display at a very low color depth (perhaps just 16-colors).
>However, when I load the list at design time, the images appear in full
>color.

>My Windows display is set for high-color, and I am displaying the image
>via an Timage component.

>I need to be able to load these images in high-color from my HDD. I'd
>appreciate any help.

Other Threads