Re: Markers

[Forwarding with permission.]

Tavmjong Bah:
> I am glad to see your efforts in marker knock-outs. I am thinking though
> that using a marker clipping path might be a little more straight
> forward and more flexible. There is a simple diagram of what I am
> thinking about at:
>
> http://tavmjong.free.fr/blog/?p=646
>
> You would have just one clip path instead of a marker-knockout-left and
> a marker-knockout-right so you wouldn't need to worry about overlap. And
> you wouldn't need the inverted keyword. The clipping path would be in
> the same coordinate system as the marker.

What I am concerned about is that what the author specifies is actually 
an inverse clipping path, and that the UA would need to construct the 
actual clipping path by inverting the path that is given.  So if the 
author specified say

   <marker strokeClipPath="M 0,0 20,5 0,10 20,10 20,0 z">
     ...
   </marker>

then internally the UA must generate a clipping path something like:

   M -1000,-1000 1000,-1000 1000,1000 -1000,1000 z M 0,0 20,5 0,10 20,10
   20,0 z

Because this is a simple, non-self-intersecting path this isn't hard. 
But once you do have a self-intersecting path (with either winding rule) 
then computing the inverse of it is going to be tricky.

That's what I was trying to avoid with the shape sides -- by having 
fixed shapes, we can guarantee that we don't have a self-intersecting path.

What we could do is to just get the author to specify a regular clipping 
path, so they would write something like:

   <marker strokeClipPath="M -1000,-1000 1000,-1000 1000,1000 -1000,1000 
z M 0,0 20,5 0,10 20,10">

and then the author is free to specify whatever they want and the 
implementation is simple.  It is more awkward than the specifying the 
shape to knock out, but that issue exists with using clipping paths more 
generally so maybe it's OK.

Would you be in favour of also allowing some keywords to specify common 
shapes?  I think it would be great if at least a rectangular area could 
be clipped out without needing to write the path string out.

> Also, I think it is good to add a one or two line note to indicate when
> something new is added to the spec as I did for 'fr':
>
> https://svgwg.org/svg2-draft/pservers.html#RadialGradientElementFRAttribute

That looks good, I'll do that.

Received on Friday, 1 June 2012 00:26:46 UTC