Anthony Walter via Lazarus
2018-04-25 00:35:23 UTC
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.
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.