How would you go about adding a alpha, lets say 20% alpha,
to a wx.bitmap so that when you draw it on a wx.dc it will appear faded or like
a watermark? Would I have to turn to a external library like PIL?
Keith Lackey wrote:
How would you go about adding a alpha, lets say 20% alpha, to a wx.bitmap so that when you draw it on a wx.dc it will appear faded or like a watermark? Would I have to turn to a external library like PIL?
It can be done with wx.Image. Perhaps something like this would work:
img = wx.ImageFromBitmap(theBitmap)
if not img.HasAlpha():
img.InitAlpha()
w,h = img.GetSize()
alphadata = chr(51) * w*h # 51 is 20% of 255
img.SetAlphaData(alphadata)
newBitmap = img.ConvertToBitmap()
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!