This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23386 - <canvas>: isPointInStroke() should not mention winding rules
Summary: <canvas>: isPointInStroke() should not mention winding rules
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-27 22:19 UTC by rcabanie
Modified: 2013-11-18 19:19 UTC (History)
3 users (show)

See Also:


Attachments

Description rcabanie 2013-09-27 22:19:25 UTC
Strokes are not done using winding. 
I've posted a couple of posts on the mailing list that list how the current algorithm for stroking is not correct.

However we finally figure out how it should be done, isPointInStroke should not say anything about winding.
Comment 1 Ian 'Hixie' Hickson 2013-10-01 20:38:45 UTC
isPointInStroke converts the path to another path, and then tests for a hit inside the area of that other path. You need to use a winding to test for a hit inside a path.
Comment 2 rcabanie 2013-10-02 05:17:46 UTC
(In reply to Ian 'Hixie' Hickson from comment #1)
> isPointInStroke converts the path to another path, and then tests for a hit
> inside the area of that other path. You need to use a winding to test for a
> hit inside a path.

It seems that we're going in circles. Your algorithm is not correct and produces paths that can't be expressed as path primitives.
The spec should just describe how the path should look. The code that converts this to a path should outline it and produce paths that can be filled with any fill rule.
Comment 3 Ian 'Hixie' Hickson 2013-10-03 18:37:47 UTC
Is the problem with the algorithm filed as a bug, or as e-mail? If as a bug, please mark this one as blocked on that one. If e-mail, can you remind me of the subject line so I can look up whether or not it's still in my pending folder?
Comment 4 rcabanie 2013-10-03 19:14:02 UTC
(In reply to Ian 'Hixie' Hickson from comment #3)
> Is the problem with the algorithm filed as a bug, or as e-mail? If as a bug,
> please mark this one as blocked on that one. If e-mail, can you remind me of
> the subject line so I can look up whether or not it's still in my pending
> folder?

email. See thread: 
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-September/040920.html
Comment 5 Ian 'Hixie' Hickson 2013-10-10 05:16:21 UTC
I didn't see anything in those e-mails that explained why the algorithm "produces paths that can't be expressed as path primitives". Can you elaborate on that?


> The spec should just describe how the path should look. The code that
> converts this to a path should outline it and produce paths that can be
> filled with any fill rule.

As far as I can tell, that's what it does. Can you be more specific about how it doesn't do that?


Feel free to close this bug and just move the discussion to e-mail if you like. Or to reply to the e-mail in this bug instead of by e-mail.
Comment 6 rcabanie 2013-10-10 05:23:10 UTC
(In reply to Ian 'Hixie' Hickson from comment #5)
> I didn't see anything in those e-mails that explained why the algorithm
> "produces paths that can't be expressed as path primitives". Can you
> elaborate on that?

From one of the threads:
  A stroked bezier curve is no longer a bezier and has to be calculated.

So, curve become higher order and have to be approximated with beziers.

> 
> > The spec should just describe how the path should look. The code that
> > converts this to a path should outline it and produce paths that can be
> > filled with any fill rule.
> 
> As far as I can tell, that's what it does. Can you be more specific about
> how it doesn't do that?

It's partly there. It's just skipping over the difficult parts (such as inflating) and wrong about others (such as dashing).
By 'describe', I mean that it should have drawings of how the strokes, line caps and line joins should look and be silent on how to actually implement it.
Comment 7 Ian 'Hixie' Hickson 2013-10-10 05:30:57 UTC
> So, curve become higher order and have to be approximated with beziers.

Sure, so? Why is approximating a problem? It's not like we're doing pure math paths here, they're all approximated at the end of the day. The spec doesn't specify how you implement it exactly, it just requires that we have consistent results that, within the limitations of the hardware (e.g. only 1 pixel for every 10 microns) are indistinguishable from the theoretical results.


> > > The spec should just describe how the path should look. The code that
> > > converts this to a path should outline it and produce paths that can be
> > > filled with any fill rule.
> > 
> > As far as I can tell, that's what it does. Can you be more specific about
> > how it doesn't do that?
> 
> It's partly there. It's just skipping over the difficult parts (such as
> inflating) 

The spec text has changed on this (see the e-mail). If there's ambiguity left, let me know (either on the e-mail, or, reply to the e-mail here and we'll move all the discussion to one place).


> wrong about others (such as dashing).

That's unclear to me. See the e-mail. Feel free to reply either in the e-mail or here (please not both though...).


> By 'describe', I mean that it should have drawings of how the strokes, line
> caps and line joins should look and be silent on how to actually implement
> it.

Why would _drawings_ be better than normative text? That makes no sense. You can't write normative specifications with sample drawings. Or at least, if you can, I certainly haven't seen it done before. Spec by example is not the level of quality that we expect at the WHATWG.
Comment 8 Ian 'Hixie' Hickson 2013-11-15 17:00:55 UTC
Are there any remaining issues to deal with for this bug, or was it solved by the thread in the WHATWG?
Comment 9 rcabanie 2013-11-18 15:36:50 UTC
(In reply to Ian 'Hixie' Hickson from comment #8)
> Are there any remaining issues to deal with for this bug, or was it solved
> by the thread in the WHATWG?

This was clarified by your latest changes and me better reading the spec.
Comment 10 Ian 'Hixie' Hickson 2013-11-18 19:19:20 UTC
Cool, thanks.