[whatwg] Stroking algorithm in Canvas 2d

Ian Hickson ian at hixie.ch
Mon Sep 9 09:33:57 PDT 2013


On Thu, 5 Sep 2013, Rik Cabanier wrote:
> 
> we've looked over the algorithm in the Canvas spec that describes how
> strokes are computed. [1]
> We think that this section is making some incorrect assumptions. For
> instance, the dashes are calculated over the total lenght of all subpaths,
> but each subpath should be treated separately.

That's intentional, otherwise if you stroke an already-dashed line, you 
get weird results.


> It's also a bit strange that the spec is trying to describe how to stroke.

It's trying to describe sufficient detail to get interoperable behaviour.


> For instance, it goes in minute detail on how dashes are applied but the
> hardest part of stroking ("inflating the paths in path perpendicular to the
> direction") is not described at all.

Is there any ambiguity in the part that's not described?


> Wouldn't it be better to remove all these steps and simply show the 
> desired effect?

Yes. I try to do this as much as possible, but whenever I can't figure out 
a way to describe something declaratively, I describe it imperatively 
instead. If you have a way to describe it that is as precise, covers all 
the same cases, yet is declarative, please don't hesitate to suggest it. I 
unfortunately find that describing things declaratively is usually only 
able to get one 90% of the way to a complete description.


> If not, what would be the best way to fix the wording?

What's wrong with the wording?


> The mailing list or a bug?

Either is fine and equivalent. (Don't do both, though, please!).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list