Hi Folks,
I've got some drawing to do (for a web app). I don't need all the MPL machinery, but I do need a high quality, fast, renderer.
Other options:
- The python bindings to GD seem to not really being maintained
- PyCairo is a pain to install, and not fast for Python (doesn't know about numpy arrays of points, for instance)
- Kiva appears to be quite enmeshed with ETS, and thus a bit of trick to install (at least without EPD or PythonXY or something)
So I thought I'd give MPL's AGG wrappers a try. I've managed to get things working, but I do have a couple questions:
1) are there docs somewhere? What I've found is very sparse, and doc strings are minimal -- though I've got the source, so only so much or a complaint.
2) It looks like the AGG renderers take floats for almost everything -- makes sense, with anti-aliasing and sub-pixel rendering. But is it float32 or float64 internally? It seems either will work, but I'm going for maximum performance, so I'd like to use the native format.
Testing drawing a polygon, I'm a bit confused about GraphicsContext vs the renderer. If I do:
gc = GraphicsContextBase()
transform = Affine2D() # default unit transform
## draw the polygon:
## create a path for a polygon:
points = np.array(((10,10),(10,190),(150,100),(290,10),(10,10)),np.float64)
p = Path(points)
gc.set_linewidth(4)
gc.set_alpha(0.75)
fill_color = (0.0, 1.0, 0.0)
line_color = (1.0, 0.0, 0.0)
#gc._rgb = line_color
gc.set_foreground(line_color)
Canvas.draw_path(gc, p, transform, fill_color)
I get a green polygon with a red border, like I'd expect. However:
Why is the outline color set in the GraphicsContext, but the fill color passed in to the draw_path call? Or am I doing that wrong?
Thanks for input,
-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
Chris.Barker@...236...