[wxruby-users] Transparent line in Frame

Alex Fenton alex at pressure.to
Mon Apr 21 08:56:00 EDT 2008


Andreas Warberg wrote:
> I want to draw transparent lines in a Frame. I have the following setup
> but my lines are not transparent.
The standard DC doesn't support transparency (except on OS X I think). 
But you can instead use wxGraphicsContext which fully supports 
transparency, antialiasing and other advanced drawing tools like splines 
and transforms. You create one from an ordinary DC like this:

paint.do | dc |
  gdc = Wx::GraphicsContext.create(dc)
  gdc.stroke_line(0, 0, 500, 500)
  # etc
end

Unfortunately the wxWidgets developers decided to make the API to 
GraphicsContext different to DC, but the results are worth it for 
graphical apps.

alex









More information about the wxruby-users mailing list