John Hunter wrote: > On Thu, Aug 6, 2009 at 1:06 PM, Michael Droettboom<md...@stsci.edu> wrote: > >> I looked into this a while ago wrt 2D quad meshes, and it didn't look like >> there was anything built-in to do something like that. All the gradients >> are 1-dimensional (i.e. between two colors, or a 1-dimensional lookup table >> of colors). There's nothing to do a 4-way blend like this. So it would >> have to be from scratch, at least for the colored part -- we can still use >> Agg to render the quad shapes themselves. >> > > What about for other backends (PS, PDF, SVG)? If there was support in > the gradient spec for these, it might be worth it to try and write a > custom gradient function in agg, as suggested by Maxim at the end of > this tutorial: > > http://www.antigrain.com/tips/gradients_tutorial/gradients_tutorial.agdoc.html > Even with this, the gradient infrastructure in Agg assumes a one-dimensional map, and here we need to at least interpolate between the three points of a triangle. It's not impossible, as it's easy enough to make a custom shader, it's just that the gradient code won't help us.
A possible workaround is suggested by this paper: http://www.svgopen.org/2005/papers/Converting3DFaceToSVG/index.html That is, rather than doing a single Gourad triangle interpolation, just overlap three linear gradient patches with alpha blending. At the very least it presents a way to support this in SVG which doesn't currently have Gourad interpolation. PDF and PS support Gourad triangles directly, though supporting it looks -- um -- "fun". Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel