[wxPython-users] Re: Trouble with drawing, I need some ideas :)
Peter Damoc
pdamoc at gmail.com
Mon Oct 1 08:18:52 PDT 2007
Problem solved via:
def SetAlpha(bmp):
w, h =3D bmp.GetSize()
img =3D bmp.ConvertToImage()
img.InitAlpha()
for i in range(w):
for j in range(h):
img.SetAlpha(i,j, 0)
return img.ConvertToBitmap()
Ugly hack but... until I find something better.... :) will have to do...
Peter
On 10/1/07, Peter Damoc <pdamoc at gmail.com> wrote:
>
> Hi Robin,
> First, let me apologize for not being clear again. :)
>
> I appreciate the advice you gave BUT it is not touching the real issue.
> The sample created was just some boiler plate for people to play with. It
> was not "efficient".
> I can do all the buffering that could be done BUT my main issue remains
> the same:
>
> How do I use alpha in a buffer that need to be blited over some other
> drawing? Color based transparency won't do because of the wxGCDC used in =
the
> buffer.
>
> Here... take a look at this kind of desperate code:
>
> cache =3D wx.MemoryDC(wx.EmptyBitmap(w,h))
> cache.SetBackground(wx.TRANSPARENT_BRUSH)
> cache.SetBackgroundMode(wx.TRANSPARENT )
> cache.Clear()
> gc_cache =3D wx.GCDC(cache)
> gc_cache.SetBackground(wx.TRANSPARENT_BRUSH)
> gc_cache.SetBackgroundMode(wx.TRANSPARENT)
> gc_cache.Clear()
>
> Maybe it expresses what I'm trying to accomplish.
>
> Peter.
> --
> There is NO FATE, we are the creators.
>
-- =
There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200710=
01/12c0c044/attachment.htm
More information about the wxpython-users
mailing list