[Lazarus] Canvas cannot draw properly if has an alpha channel?

Anthony Walter sysrpl at gmail.com
Wed Apr 25 02:35:23 CEST 2018


I am going to file a bug for this, but wanted to check with other people
first to see if I'm overlooking something.

So the problem is you cannot draw properly to any canvas backed by alpha
channel.

For example, if you have 2 TPortableNetworkGraphic images with images that
contain alpha channels and try to draw from one to another using
Canvas.Draw, the destination will be filled with black. The expected result
should be the source image be copied over.

I'm not sure, but I think all TCanvas drawing operations on graphic objects
with a pf32bit pixel format don't work. Essentially that are read only
surfaces. Is this intended and a won't fix problem or is there a chance
someone is willing to fix this problem?

On Windows the fix is to use the AlphaBlend function instead of BitBlt

https://msdn.microsoft.com/en-us/library/windows/desktop/dd183351(v=vs.85).aspx

On Gtk2 the fix is to use a temporary Cairo surface with cairo_set_source,
and cairo_fill or cairo_paint_with_alpha instead of Gdk graphic commands.

I'm not sure about Qt or Carbon.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180424/6d720191/attachment-0001.html>


More information about the Lazarus mailing list