How to convert icon to png with alpha transparency in delphi?

前端 未结 3 953
萌比男神i
萌比男神i 2021-02-09 10:15

The code below will extract icon from file and convert it to png but without alpha transparency ?

var
   IconIndex : word;
   icon:TIcon;
   png:TPngImage;
   bm         


        
3条回答
  •  不思量自难忘°
    2021-02-09 11:03

    Although TPngImage is no longer open source, if I take a quick look in an old copy I have lying around here, TPngImage.Assign only checks if the source is a TPngImage, and if not lets the 'default' assign do it's work, and for TBitmap or TGraphic, this will most probably use a plain draw on the canvas which throws away the transparency.

    This looks like something to post on Delphi QC

提交回复
热议问题