Carl Karsten wrote:
> I am trying to make some translucent circles, and it isn't happening.  The 
> code
> below should have the red bleed through everything else, but everything else 
> is
> opaque.

FloatCanvas was written before wx had support for alpha channels. It 
uses the older "DC" classes, that don't support transparency. You can 
achieve what you want, but you'll need to create a new DrawObject that 
uses a GraphicsContext to do the drawing. Here is an example that should 
get you started:

http://morticia.cs.dal.ca/FloatCanvas/wiki/SmoothLines

By the way, aside from time, I haven't converted all of FloatCanvas to 
GraphicsContext, 'cause it can have substantially worse performance for 
lots of complex objects.

> Also, why do I need .Canvas for .NavCanvas(self).Canvas when I don't for
> FloatCanvas(self)?

Because NavCanvas is a wx.Panel that has a FloatCanvas on it, rather 
than _being_ a FloatCanvas. I originally tried to delegate all the calls 
made on NavCanvas to the underlying FloatCanvas, but things got confused 
when there was a call that could apply to either the parent Panel or the 
underlying FloatCanvas, so this seemed easier.

NavCanvas is really just a convenience class that adds a toolbar for 
you. For more complex applications, you'll probably want to just create 
your own container class, perhaps using NavCanvas as a model.

> Also, the circle border does not scale.

Correct -- I designed FloatCanvas with certain uses in mind -- usually 
displaying data of some sort. In those use cases, you don't want the 
line thicknesses and all scaling.

In other uses, you certainly would want that (as you do!). It should be 
pretty straightforward to make a new DrawObject class that scales the 
line widths too. You might look at the ScaledText class to get an idea 
how to do that -- it changes the font size with scale, which is similar 
to changing the line width.

Ideally  this would be factored into all DrawObjects with a line width, 
so that you could pass a flag in indicating whether you wanted line 
widths scaled or not. Patches welcome! (I'd start by writing your own 
circle class, to see how it's done, then figure out how it could be 
better integrated with the existing classes)

-Chris


-- 
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

[EMAIL PROTECTED]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to