Semi-transparent fills

To get aphablending you need to use something like wx.GCDC

something like this:

    pdc = wx.PaintDC(self)
    dc = wx.GCDC(pdc)
    dc.DrawRoundedRectangleRect(....)
···

On 5/13/07, Daniel B. Koch kochdb@ornl.gov wrote:

Hi folks,

I’m trying to find an efficient way to do semi-transparent fills for
DC.DrawPolygon so I can highlight areas of a background bitmap like a
photo. In 2.8.3 you can specify an alpha value for wx.Colour
but
wx.Brush does not seem to respect this. Here’s what I currently do to
get around this:

  1. Draw an unfilled polygon, get its bounding box, and extract a DC
    sub-bitmap.
  2. Redraw the polygon filled, extract another DC sub-bitmap, and use the

fill color to set a mask.
3. Create a semi-transparent bitmap (using wx.Image alpha commands) the
same size as the bounding box.
4. Draw in order at the correct location:
a. Sub-bitmap from step 1
b. Semi-transparent bitmap from step 3

c. Sub-bitmap from step 2

This seems to work across all three platforms (Windows, Linux, Mac).
What I’d really like is a semi-transparent brush style.

Thanks,
Dan


Dr. Daniel B. Koch

Oak Ridge National Lab
http://www.ornl.gov/sci/gist/bios/bio_koch.html
(865) 241-9096


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org


There is NO FATE, we are the creators.