[wx-dev] wxGTK: Drawing on a bitmap with Alpha
Stefan Csomor
csomor at advancedconcepts.ch
Wed Oct 17 02:32:00 PDT 2007
Hi
Robin Dunn wrote:
> Hi (Stefan),
>
> If I have a bitmap with alpha and draw upon it via a wxMemoryDC, then
> there are some inconsistencies across platforms. If I use just the
> MemoryDC then on wxMSW and wxGTK the alpha is not made opaque for the
> new pixels that are drawn, which is probably to be expected. (wxMac
> does change the alpha for the drawn pixels.)
yes, because the basic ops on the older drawing systems don't know about
alpha, and wxMac is always using wxGCDC when using Core Graphics
> However if I use a wxGCDC with the MemoryDC as the target then both
> wxMac and wxMSW appear to do the right thing and the alpha for the
> drawn pixels are reset to opaque but on wxxGTK they are still not
> touched. Is there a way to get wxGTK to behave the same in this case?
as wxGCDC is using the new alpha aware drawings I think it is reasonable
to support this alpha drawing for the wxDC API, otherwise we'd force
people to switch completely do wxGraphicsClasses just for getting alpha
drawing
now the question is, why the cairo case doesn't draw correctly, you
create a bitmap with depth 32, which should result in a pixbuf with
alpha = true, now the wxMemoryDC select call however always uses a
GetPixMap on the bitmap, which converts the alpha pixbuf back to a
pixmap with mask, and just from looking at the code - I don't have a
debugging env for gtk working righ tnow, I guess that's where the
problem arrises ...
if this truly is the source of the problem, or how to best fix it, I
cannot say, perhaps we should just add a Create... to graphics renderer
taking directly a wxBitmap , that way we could mandate that it's a 32
bit pixbuf, and we wouldn't interfere with any other code...
Best,
Stefan
--
Advanced Concepts AG
Software-Engineering
Heldweg 10
CH-8475 Ossingen
Switzerland
phone:+41 52 245 0 245
fax:+41 52 245 0 246
http://www.advanced.ch
mailto:csomor at advanced.ch
More information about the wx-dev
mailing list