Re: stroke=gradient for lines or horizontal paths

 Hi David,

 I learned about this limitation a few years ago when I programmed a 
 little color picker with sliders that had gradients on a line. I had to 
 change to <rect/> elements instead of <line/> elements for this purpose.

 I think this is a ugly limitation in SVG, and although Rob is right 
 that the browsers are ok (those <line/> elements do not establish a 
 bounding box), due to the spec, it is hard to explain to users that one 
 cannot easily have gradients on vertical or horizontal lines.

 I am not sure if the SVG WG is able to fix this issue?

 Andreas

 On Tue, 12 Jul 2011 20:04:34 -0400, David Dailey wrote:
> Hi folks,
>
> In the relatively simple file at
> http://srufaculty.sru.edu/david.dailey/svg/text/gradientLines.svg [1]
> (source code included below), a series of five nearly horizontal 
> lines
> is drawn using either  or  . In three cases the stroke value is a
> pointer to a gradient. In one of those cases, the line is drawn to be
> just a tad off of true horizontal.
>
> The following browsers fail to properly portray the gradient in the
> two cases that a truly horizontal line is stroked by a gradient:
>
> Opera 11.5
>
> Firefox 5
>
> IE 9
>
> Chrome
>
> Safari
>
> Safari and FF actually draw five lines (the others draw only three),
> but the gradients are ignored.
>
> Sigh… it looks like ASV passes the test though, so we can't hardly
> call it an "acid test" now can we since ASV was born before Hixie?
>
> Actually, since so many browsers seem to misfire here, perhaps the
> spec should say something like "lines may be stroked by gradients 
> even
> when they are horizontal."
>
> Cheers
>
> David (whose reason for creating this example may be made clearer by
> my next post)
>
> --------------source code---------------
>
>
>
> Links:
> ------
> [1] http://srufaculty.sru.edu/david.dailey/svg/text/gradientLines.svg

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 Grüt (Gossau ZH)
 Switzerland

Received on Wednesday, 13 July 2011 06:33:33 UTC