Ah, thankyou this is exactly what I was looking for. Although I fear this will greatly delay the writing of my thesis!
Simon. On Tue, 26 Jan 2016 14:12:00 +0100 André Wobst <[email protected]> wrote: > Hi Simon, > > sorry for my late reply. > > As we added 3d graphs with surfaces, we indeed added a feature called > "meshs", which can be used to fill triangles with color gradients. (While > there are other mesh forms in Postscript and PDF as well, we only support > triangular meshs.) > > Here is a simple example drawing a square with red, green, blue and yellow on > each of the corners (in RBG here): > > from pyx import * > > c = canvas.canvas() > c.insert(mesh.mesh([mesh.element([mesh.node([0, 0], color.rgb.red), > mesh.node([10, 0], color.rgb.green), > mesh.node([0, 10], color.rgb.blue)]), > mesh.element([mesh.node([10, 10], color.rgb(1, 1, 0)), > mesh.node([10, 0], color.rgb.green), > mesh.node([0, 10], color.rgb.blue)])])) > c.writePDFfile() > > The mesh interpolates between the colors in the given color model linearly. > Meshs are available in Postscript and PDF, not in SVG. > > Note that meshs are a "difficult" graphics feature. There are sometimes bugs > in the RIPs of printers or viewer applications. As ghostscript can rasterize > those meshs rather nicely, you can set the mesh_as_bitmap flag of the writer > to replace the mesh by a bitmap. Also note that meshs are not available in > SVG. There will always be a bitmap inserted in SVG instead of the original > mesh. > > (Note that in SVG there are simple gradients possible: linearly and circular > gradients similar to what you quoted from cairo in another reply in this > thread. But mesh-like color gradients on triangles are not available. Maybe > there are some tricks to "fake" this in SVG my two overlapping gradients and > using transparency, but I didn't look at it at all. The gradient features of > SVG are not available from within PyX at the moment.) > > Best, > > > André > > Am 23.01.2016 um 16:33 schrieb Simon Burton <[email protected]>: > > > > > Hi Pyxers, > > > > is there a way to fill paths with a gradient, instead of a single colour? > > > > I am bravely attempting to render some stylized 3D objects and gradients > > sure > > would help with this. > > > > Ok, thanks. > > > > Simon. > > > > ------------------------------------------------------------------------------ > > Site24x7 APM Insight: Get Deep Visibility into Application Performance > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > > Monitor end-to-end web transactions and take corrective actions now > > Troubleshoot faster and improve end-user experience. Signup Now! > > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > > _______________________________________________ > > PyX-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/pyx-user > > -- > by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim > / \ \ / ) [email protected], http://www.wobsta.de/ > / _ \ \/\/ / PyX - High quality PostScript and PDF figures > (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
