[wxPython-users] LCD vs CRT Monitors Issues (!)
Christopher Barker
Chris.Barker at noaa.gov
Fri Nov 2 14:02:34 PDT 2007
Nitro wrote:
> I guess what's happening is that the anti-aliased text is blended with
> your mask colour,
I agree -- anti-aliasing and masks don't work out so well.
> Now I am not sure if wx can do all this kind of alpha handling.
It can -- you need to create a transparent bitmap, then draw to it with
GraphicsContext (I think -- maybe you an still draw with a DC). I don't'
think there is a direct way to create an alpha bitmap, but there were
some recent posts here about how to do it.
From Robin:
"""
It creates a new bitmap with all pixels set to black and with a fully
transparent alpha:
bytes = array.array('B', [0] * width*height*4)
bmp = wx.BitmapFromBufferRGBA(width, height, bytes)
Then any drawing you do on it with a wx.GCDC or a wx.GraphicsContext
will be working on a fully transparent background, and will reset the
alpha as as specified in the pen or brush objects when drawing other
things on top of it.
"""
There you go!
-CHB
I guess
> especially the "draw font into bitmap preserving alpha information" part
> might be impossible. Then you could probably just fill the bitmap with
> the background colour initially instead.
>
> -Matthias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list