W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

Re: [whatwg] Stroking algorithm in Canvas 2d

From: Jasper St. Pierre <jstpierre@mecheye.net>
Date: Thu, 10 Oct 2013 08:55:57 -0400
Message-ID: <CAA0H+QQExXtUm+uONysuw1Z_SFGzczwaCD-RhRWxGcgg3ouQXA@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>, Rik Cabanier <cabanier@gmail.com>, syhann@adobe.com
On Thu, Oct 10, 2013 at 2:19 AM, Ian Hickson <ian@hixie.ch> wrote:

> On Wed, 9 Oct 2013, Rik Cabanier wrote:
> > > >
> > > > Yep, this is where assumptions went wrong. Dashes are calculated per
> > > > subpath, not per 'line'/whole path.
> > >
> > > On what basis are you asserting this?
> >
> > see this fiddle: http://jsfiddle.net/6eGxU/25/
>
> This demonstrates pretty well what is wrong with the algorithm you're
> suggesting (and which is implemented in Chrome). Why shouldn't we take
> this opportunity to fix it?
>
> Here's an even better example of the problem:
>
>    http://goo.gl/hwK7fv
>
> It doesn't make any sense, as far as I can tell, that the lines in the
> discontinuous box would have different gaps than the line in the
> continuous box. They're the same lines. Only the joins should be
> different. Why would we do this?
>
> (Note that in most cases you can simulate the effect of restarting with
> each subpath pretty easily by just painting the subpaths separately,
> instead of as one single path. I don't see any good way to simulate the
> way it's specced with the model you describe.)
>
>
> > I think most (all?) graphics libraries traces their root back to
> > PostScript. PDF, Core Graphics, Cairo and Direct2D all follow the same
> > algorithm.
>
> If there's a good reason to do this, other than "we've always done it this
> way", then it's certainly a good thing to consider. If none of the
> browsers are willing to implement it the way the spec describes it, that's
> also a reason to change the spec. But just that it's always been done that
> way isn't a reason at all.
>

Differentiating from the drawing model we've always been used that can
easily be used by their underlying libraries seems like churn for both
people used to vector graphics libraries (a number of people using cairo
are porting their projects over to <canvas>), and implementers.


> > They're not always lines though. What about curves?
>
> Curves are lines too. The spec uses the term "path", though.
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>



-- 
  Jasper
Received on Thursday, 10 October 2013 12:56:29 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:11 UTC