From: Alan W. I. <ir...@be...> - 2008-10-09 19:05:04
|
What started me thinking about how to support gradients within PLplot is the large PLplot logo at the top of our webpage which is smoothly darkened on the left. I don't know how Werner created that effect, but it is unlikely to be within PLplot because we currently don't support gradients. Instead, what we do (e.g., example 16) is approximate gradients by a series of (normally rather wide) steps. Thus, in my attempt to mimic that logo within PLplot, I plan to approximate the darkening effect, but I may have to use a lot of narrow steps to get a good-looking smooth effect. This seems a misuse of SVG which natively supports gradients so I may just hand-edit the SVG code for the rectangle involved to apply a smooth gradient to it. I have done a quick google survey, and it appears most/all of our modern devices (e.g., svg), and at least one of our older devices (e.g., ps) have native gradient capability. This represents an opportunity for PLplot to also support RGB (and RGBA) gradients for those drivers with that capability. That would obviously help for such specialized applications as generating our logo, but I think it would also be a big improvement for all our plot styles that represent surfaces. To take a concrete example, look at http://plplot.sourceforge.net/examples-data/demo08/x08.01.png where there is room for improvement in how the bottom of the banana-shaped valley is represented even for the relatively fine grid used for that example. Typically, we represent those surfaces as a series of filled triangles. The three points of the triangle allow you to approximate the local gradient and apply it to the RGB and alpha of the colour of the triangle. That implies much smoother looking surface results and/or larger triangles/smaller plot files to represent the same surface for those devices that have native gradient support. Note, the question of PLplot support for gradients has internal core library implications (e.g., triangle representation for surfaces), API implications (what is the most convenient way to let PLplot users specify gradients?), and implications for each driver with potential native gradient capability (how to translate from PLplot's representation of gradients to the driver's representation). Furthermore, we will probably want to do a core library fallback if the device driver doesn't have native gradient capability. Note, so far I have only been talking about linear gradients, and my preliminary feeling is we should stick just to those, but I should at least mention that there are other kinds of gradient styles as well, see, e.g., the radial gradient that is supported in the SVG specification (http://www.w3.org/TR/SVG/pservers.html). So there is a lot to consider here. Nevertheless, gradient capability is obviously important for graphics, and I therefore think it is time we started discussing how we should support gradients with PLplot. So please give your thoughts on this topic especially if you can think of better ways to implement it than my preliminary thoughts on that matter above. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |