[cairo] Rectangles and Gradients

cecashon at aol.com cecashon at aol.com
Thu Oct 10 18:43:52 UTC 2019


Hi all,

When a rectangle gets rotated in 3d and then flattened to 2d it can become a trapezoid. If a linear gradient is drawn using one side of the trapezoid the gradient becomes "angled." A mesh gradient solves this but the mesh gradient doesn't output to text in a svg. The mesh gradient isn't defined for svg 1.0 so the output gets rasterized. Is there a way to have a linear gradient draw like a mesh gradient in 3d so that svg can be output as text? Maybe some geometry that I am missing. It would be a good thing to be able to output mesh gradients as text in svg.

The histogram_chart3d program rotates some rectangles in 3d with cairo. It compares mesh gradients and linear gradients along with the output to svg. If interested in taking a look, build instructions are at the top of histogram_chart3d_UI.c or a make file if you have gtk3 and freetype libraries to link to. Cairo draws very well here. Even the mesh gradient cylinders look really good.

https://gitlab.com/cecashon/OrderedSetVelociRaptor/tree/master/Misc/cairo3d

Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20191010/43fb565b/attachment.html>


More information about the cairo mailing list