ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Best practice for adding an image from TIEBitmap to a TImageList?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

1006 Posts

Posted - Oct 17 2025 :  12:41:07  Show Profile  Reply
I am adding the image from a TIEBitmap to a TImageList by keeping transparency:

Is the following processing order correct and optimal for keeping the transparency of the image?

IEBitmap := TIEBitmap.Create;
try
  // 1. Load the image first
  MemStream.Position := 0;
  IEBitmap.IO.LoadFromStream(MemStream);
  
  // 2. Resize (while still at full color depth)
  IEBitmap.Resample(24, 24, rfLanczos3);
  
  // 3. Configure for transparency AFTER loading and resizing
  IEBitmap.VclBitmap.PixelFormat := pf32bit;
  IEBitmap.VclBitmap.AlphaFormat := afDefined;
  
  // 4. Add to ImageList
  ImageIndex := FImageList.Add(IEBitmap.VclBitmap, nil);
finally
  IEBitmap.Free;
end;

xequte

39222 Posts

Posted - Oct 19 2025 :  17:04:50  Show Profile  Reply
Hi Peter

You are better to use:
https://www.imageen.com/help/TIEBitmap.AddToImageList.html

IEBitmap := TIEBitmap.Create;
try
  // 1. Load the image first
  MemStream.Position := 0;
  IEBitmap.IO.LoadFromStream(MemStream);
  
  // 2. Resize (while still at full color depth)
  IEBitmap.Resample(24, 24, rfLanczos3);
  
  // 3. Add to ImageList
  ImageIndex := IEBitmap.AddToImageList( FImageList );
finally
  IEBitmap.Free;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: