Open wxtrac opened 10 years ago
demo_dest.png
(0.4 KiB)demo_source.png
(0.4 KiB)wx_graphics_context.diff
(1.1 KiB)When creating a wxMemoryDC from a wxBitmap with alpha, the best we can currently do with GTK2 is to convert the alpha to a mask. Drawing on the bitmap does not affect the mask, and the mask is later converted back to alpha, wiping out any drawing in the masked area. This could in theory be fixed for GTK+ 2.8 and later by using Cairo instead of GDK (see #10066).
You can work around this by drawing directly to a window instead of a bitmap.
Issue migrated from trac ticket # 15735
component: wxGTK | priority: normal | keywords: wxGraphicsContext, transparency, alpha
2013-11-30 13:00:59: alexandrub created the issue
(copied from wx-users)
ACB> Here is a patch to the "drawing" sample and 2 pngs with alpha channel. ACB> Both non-visible patches should appear in the resulting bitmap. But only ACB> the first is visible, as the second is only painted over the invisible ACB> channel. ACB> As documented in the algorithm paper:
ACB> http://keithp.com/~keithp/porterduff/p253-porter.pdf the composition modes ACB> wxCOMPOSITION_OVER or wxCOMPOSITION_DEST_OVER should do just that. ACB> ACB> Am I missing something here?
It looks like this ought to work but OTOH I don't see anything obviously wrong in wxCairoContext::DrawBitmap() code neither: wxGraphicsBitmap should have the correct alpha channel and Cairo should take care of the rest. In short, this needs to be debugged to see what is really going on here. If you can try to do it, it would be great. If not, please open a Trac ticket and attach your diff and bitmaps to it so that at least a record of this bug is left.
Thanks, VZ