Does the delphi TBitmap support an alpha channel

只谈情不闲聊 提交于 2019-12-05 02:16:33

问题


I'm hearing people say that it is not.

However, I created a TBitmap and cleared the entire area by

For I := 1 to bmp.Width do
  For J := 0 to bmp.Height do
    bmp.canvas.Pixels[I,J]:= $00000000;

Then I drew anti-aliased text onto the bitmap and saved it to file. Upon opening it in gimp it shows the transparency information.

Does anyone have a definitive answer on this and if it does work then more information on how it works? I've tried playing around with the last byte and I'm not getting the expected results when i open it in gimp.


回答1:


It does, but you have to set

bmp.PixelFormat := pf32bit;



回答2:


The Delphi TBitmap is just a wrapper around the Windows BITMAP object. So, yes it does support alpha channels, but clearly you must set the PixelFormat property appropriately.



来源:https://stackoverflow.com/questions/4680429/does-the-delphi-tbitmap-support-an-alpha-channel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!