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
 Import a TRANSPARENT image from a TImageList and keep the transparency
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

978 Posts

Posted - May 16 2025 :  04:56:30  Show Profile  Reply
In ImageEnView, I use this method to import a TRANSPARENT image from a TImageList and keep the transparency:

procedure TForm1.ButtonGetImageFromImageListClick(Sender: TObject);
var
  Icon: TIcon;
begin
  Icon := TIcon.Create;
  try
    Icon.Transparent := True;
    ImageList1.GetIcon(0, Icon);
    ImageEnView1.Assign(Icon);
    ImageEnView1.Update;
  finally
    Icon.Free;
  end;
end;




attach/PeterPanino/20255161395_ImageEnViewGetTransparentImageFromImageList_V2.zip
18.05 KB

Is there a better built-in method in ImageEn to do this (like in TImageEnMView)?

Such a method could have an optional Transparency parameter to configure the Alpha channel, for example:

ImageEnView1.ImportImage(ImageList1, Index, Alpha);

This would be very helpful!

xequte

39015 Posts

Posted - May 16 2025 :  16:45:38  Show Profile  Reply
Thanks Peter,

We'll look into that.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

978 Posts

Posted - May 17 2025 :  03:47:28  Show Profile  Reply
Unfortunately, the VCL TImageList provides only an outdated technology with static pixel images (bmp, ico, png), whereas the DevExpress TcxImageList can also store SVG images.

The only free alternative is SVGIconImageList (Open Source from Ethea).

On the other hand, TIEBitmap has only an AddToImageList method, but not an explicit GetFromImageList method!

After getting artefacts with the TIcon method in a specific corner case, I now use a TBitmap with AlphaFormat:

bmp := TBitmap.Create;
try
  bmp.Width := W;
  bmp.Height := H;
  bmp.PixelFormat := Vcl.Graphics.pf32bit;
  bmp.AlphaFormat := Vcl.Graphics.afDefined;
  ImageList1.GetBitmap(0, bmp);
  ImageEnView1.Assign(bmp);
  ImageEnView1.Update;
finally
  bmp.Free;
end;
Go to Top of Page

xequte

39015 Posts

Posted - May 17 2025 :  16:06:46  Show Profile  Reply


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