[whatwg] Stroking algorithm in Canvas 2d

Justin Novosad junov at chromium.org
Thu Oct 10 14:36:18 PDT 2013


On Thu, Oct 10, 2013 at 4:20 PM, Rik Cabanier <cabanier at gmail.com> wrote:

> Dean, Roc, Justin,
>
> would you change Canvas' stroking behavior so it no longer matches SVG and
> CSS and your underlying graphics libraries?
>

My first reflex is to say that of course it would be convenient for
implementors and web developpers alike if dashes were consistent across all
web standards. I don't feel super strongly about that though, and could
easily be convinced otherwise. How much does that really matter to the Web?
However, I do think there should at least be an easy way to draw a box with
dashed borders in a way that mimics CSS dashed borders-, which looks a lot
better than what canvas does out of the box. Doing the same in canvas is a
bit too tricky right now IMHO.

Also, we shouldn't have to implement a special dash rendering algorithm
just for canvas (as is suggested by the spec). That being said, I don't
think that is really an issue. From an implementor's perspective, most of
what is in the canvas spec and the tweaks discussed in this thread can be
at least approximately mapped to the pre-canned dashing models of most
graphics APIs by just massaging the data in the bindings that tie the
layout/rendering engine to the graphics API. There is just the feature of
applying line caps on individual dashes that requires a bit of extreme
massaging (at least with skia). But that's OK. It's a useful feature and
SVG already does it.


>
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
>> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>>
>
>



More information about the whatwg mailing list