Discussion:
About the ancient problem of Colors and Alpha Values in wx.MemoryDC
sesenmaister
2014-05-12 11:21:04 UTC
Permalink
There are already a dozen alpha channel related open bugs in the database:

http://tinyurl.com/yuspj9

But I see that there are no new topics in about 2 years, and wxpython 3.0.0
was shipped half year ago.


My case is When in a wx.MemoryDC() painted of some color, I draw an
alpha-bitmap over:the DrawBitmap action makes disappear the previous color,
no matter the size of the bitmap drawed upon.

In my case, It Fails/Works:

DOES WORK with : __WXMAC__ (3, 0, 0, 0, '') wx.VERSION
: __WXMSW__ (2, 8, 12, 1, '')
: __WXGTK__ (2, 8, 12, 1, '')

DOESNT' WORK with : __WXMSW__ (3, 0, 0, 0, '')


I've tried to import the image from PIL to try preserving the alpha using
the ImageConversions methods. But same result.


So my question is...
- Cannot we trust using Alpha in a wx.MemoryDC ?
- Am I doing something from Tutankhamon era and should steadly change my
habits into new ones?


P.D. Working example attached.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sesenmaister
2014-09-10 12:46:23 UTC
Permalink
I found the answers to my own questions in a previous post although I did a
lot of research before asking:
https://groups.google.com/d/msg/wxpython-users/oCoMbebHzpE/gMtT7Ea6iX8J:


As said by Robin Dunn:

In an nutshell, wx.DC is designed for old-style 24-bit raster based

drawing with no alpha nor anti-aliasing other than drawing bitmaps that

have alpha and drawing text, but only if the platform automatically

anti-aliases text. wx.GraphicsContext on the other hand is designed to

be implemented using the new-style drawing APIs available on each

platform (GDI+, CoreGraphics, or Cairo) and is meant to be more vector

based and to fully support alpha and anti-aliasing. wx.GCDC is a hybrid

of the two where the DC API is reimplemented using wx.GraphicsContext.



So if you want to draw with alpha then you need to switch to using

wx.GraphicsContext or use wx.GCDC.
Post by sesenmaister
http://tinyurl.com/yuspj9
But I see that there are no new topics in about 2 years, and wxpython
3.0.0 was shipped half year ago.
My case is When in a wx.MemoryDC() painted of some color, I draw an
alpha-bitmap over:the DrawBitmap action makes disappear the previous color,
no matter the size of the bitmap drawed upon.
DOES WORK with : __WXMAC__ (3, 0, 0, 0, '') wx.VERSION
: __WXMSW__ (2, 8, 12, 1, '')
: __WXGTK__ (2, 8, 12, 1, '')
DOESNT' WORK with : __WXMSW__ (3, 0, 0, 0, '')
I've tried to import the image from PIL to try preserving the alpha using
the ImageConversions methods. But same result.
So my question is...
- Cannot we trust using Alpha in a wx.MemoryDC ?
- Am I doing something from Tutankhamon era and should steadly change my
habits into new ones?
P.D. Working example attached.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...