xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nico Talian <natal...@cs.brown.edu>
Subject Re: [commit] MutlitpleGradientPaintContext
Date Wed, 06 Dec 2000 14:22:31 GMT

Hmmm, this could be problematic, because the SVG spec says

"If two gradient stops have the same offset value, then the latter
gradient stop controls the color value at the overlap point."

If this is in fact the behavior we want, then additional changes need to
be made because right now the example and changes you provide will
probably be rendered as a smooth gradient going from black....red and then
abruptly change from red to blue (instant change because the lookup method
will switch from one gradient array to the other), then followed by
a blue...white transition.

There probably should be another loop to go over the entire input arrays
and remove overlapping stops like this and always choose the latter point
in these cases.

I may be mistaken, but that is my analysis of the situation.

Also, I get the same Python exception when accessing the CVS Respository
link on the main page, so anything you can do to fix it would be great.

-Nico

On Wed, 6 Dec 2000, Christophe Jolif wrote:

> Hello,
> 
> The following SVG file:
> 
> <svg width="640" height="480">
>   <defs>
>     <linearGradient id="grad" x1="0" y1="0" x2="1" y2="0"
> gradientUnits="objectBoundingBox">
>       <stop offset="0" style="stop-color:black"/>
>       <stop offset="0.2" style="stop-color:red"/>
>       <stop offset="0.2" style="stop-color:blue"/>
>       <stop offset="1" style="stop-color:white"/>
>     </linearGradient>
>   </defs>
>   <rect x="0" y="0" width="640" height="640" style="fill:url(#grad)"/>
> </svg>
> 
> was rejected by Batik (in fact by the gradient paint) because two stops
> had equal value (0.2). However specification accept such a case. I
> modified MultipleGradientPaintContext to fix it. It is just a
> "(currentPosition <= prevPosition) then error" test that has been
> modified to "(currentPosition < prevPosition) then error" test. And a
> test to automatically go to slow gradient compute method if such case is
> encountered (to avoid division by 0 as Imin = 0). The rest of the code
> was ok to deal with this particular case.
> 
> -- 
> Christophe
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
> 
> 



Mime
View raw message