[matplotlib-devel] Using the Agg renderer by itself

2011-11-23 Thread Chris.Barker
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.bar...@noaa.gov

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Using the Agg renderer by itself

2011-11-23 Thread Chris.Barker
On 11/23/11 9:52 AM, Chris.Barker wrote:
> 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.

One more question. I see:

 def draw_markers(self, *kl, **kw):
 # for filtering to work with rastrization, methods needs to be 
wrapped.
 # maybe there is better way to do it.
 return self._renderer.draw_markers(*kl, **kw)

What do I pass in to this function?

Thanks,
   -Chris




> 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.bar...@noaa.gov

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Using the Agg renderer by itself

2011-11-23 Thread Friedrich Romstedt
2011/11/23 Chris.Barker :
> 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.

http://www.effbot.org/zone/aggdraw-index.htm

http://www.effbot.org/imagingbook/imagedraw.htm

Don't know if this suffices your needs.

Friedrich

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Using the Agg renderer by itself

2011-11-23 Thread Benjamin Root
On Wednesday, November 23, 2011, Chris.Barker  wrote:
> 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
>
>

There is an HTML5 backend, supposedly.  Don't know how well documented it
is, though.

Ben Root
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Using the Agg renderer by itself

2011-11-23 Thread Chris.Barker
On 11/23/11 10:38 AM, Benjamin Root wrote:

> On Wednesday, November 23, 2011, Chris.Barker  > wrote:
>  > 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.

> There is an HTML5 backend, supposedly.  Don't know how well documented
> it is, though.

Hmm -- coll idea -- I'll look into that at some point. However, as I 
don't need the MPL machinerey, but just the renderer, I'm not sure it 
would buy me much.

And I'm not sure I can:

a) count on html 5 on all browsers we need to support

or

b) get the drawing performance I want if I have to push all the data to 
the client to draw.

But something to keep an eye on, thanks.

-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.bar...@noaa.gov

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel