- From: Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
- Date: Tue, 07 Feb 2012 15:52:51 +0100
- To: www-svg@w3.org
On 06-02-12 21:12, Tavmjong Bah wrote: > ... > @Israel: In your test at > http://owl3d.com/tests/Gradient_Mesh/lerpHermite.html , try putting in > the values [[0,0,0][127,127,127][255,255,255]]. The resulting gradient > has visual artifacts. In this case you don't want the derivative to be > zero at the border. You do want the derivative to be the same on both > sides and these derivatives may be different for the different colors. > > I find the keySpline idea interesting as this allows any slope at the > edge (but you would still have problems of needing to match slopes of > three different colors). I am not sure how you would paint an arbitrary > shaped patch. The Cairo rendering library algorithm of dividing a patch > horizontally into patches that have a width of no greater than one pixel > and then painting each of those patches as a Bezier line would need to > be modified in a non-trivial way. For export to PostScript/PDF one could > subdivide the patch as is done by Illustrator and export type 6 or 7 > patches. The keySpline idea is indeed very interesting (and would fit in well with sticking to linear and cubic interpolation). Also, I do not think this should cause problems with matching slopes of three different colors? Basically you just control the colors independently, so if you "mirror" the handles around a boundary I would expect all colors to match up. In particular, you do not suffer from the same problem as with linear gradients where you cannot have independent gradients for the three color channels (which is due to interpolating between two points). As for the rendering algorithm, the resulting patches are just the normal cubic Bezier patches if the color interpolation is linear. If the color interpolation is also cubic, then you can essentially do three things: 1. Just sample as you would if the color interpolation was linear. 2. Use the same sample locations, but "prefilter" the colors. 3. Adjust sampling to take color interpolation into account. Option 1 is obviously the simplest approach and probably sufficient for most purposes. Option 2 is essentially the same, just "better" (and not especially hard to implement). Option 3 is probably also doable, but requires some more analysis.
Received on Tuesday, 7 February 2012 14:57:05 UTC