Re: The canvas element (detailed review)

On 01/02/08 01:58, Ian Hickson wrote:
> On Sat, 4 Aug 2007, Philip Taylor wrote:
>> fill:
>>
>> "The fill() method must fill each subpath of the current path in turn" - 
>> that sounds incorrect - in current implementations it only paints one 
>> shape, which is made from all the subpaths at once. (If two overlapping 
>> but otherwise independent subpaths have opposite windings, they cancel 
>> out and result in no fill. If they have the same winding, that area just 
>> gets painted once.)
> 
> Is the new text enough? Or do I need to be more explicit?

The new text doesn't sound incorrect. The (normative) new text doesn't 
sound unambiguously correct either, but the note makes it clear enough, 
so I don't think there's any practical value in being more detailed in 
the normative description.

>> "the non-zero winding number rule" - that isn't defined, and it's not 
>> obvious what it means, so I think it should be defined here. 
>> http://www.cs.rit.edu/~icss571/filling/alt_parity.html and 
>> http://www.w3.org/TR/SVGMobile12/painting.html#FillRuleProperty sound 
>> like reasonable explanations.
> 
> Isn't it obvious what it means to anyone who is going to be implementing 
> it? I'd love to add a reference, but if I add one I'd like it to be The 
> Original Reference, and I haven't been able to track down who originally 
> formulated this rule.

That means an 'average' person can't implement HTML5 simply by reading 
the spec (plus normative references); but I suppose that's reasonable 
here, since describing canvas rendering in that much detail would be 
like writing a whole graphics library implementation, which would be a 
lot of work and wouldn't really help anyone (since implementors will 
actually know about maths and graphics, and they'll mostly reuse an 
existing library anyway).

>> stroke:
> 
> I've clarified it a bit, but not very well. Let me know if you have any 
> suggestions for better text.

Perhaps "The stroke() method must calculate the strokes of all the 
subpaths of the current path, using the lineWidth, lineCap, lineJoin, 
and (if appropriate) miterLimit attributes, and then fill the combined 
stroke area using the strokeStyle attribute." would make it clearer that 
no area gets stroked more than once and it doesn't do non-zero winding 
things between subpaths.

>> "canvas' coordinate space" - that is written "canvas coordinate space" 
>> elsewhere (which is better since I wouldn't be tempted to complain about 
>> "canvas'" vs "canvas's").
> 
> Fixed, though there's still another canvas', if you want to complain in 
> vain. :-)

Hmm, the only one I can see is in "var canvas = 
document.getElementsByTagName('canvas')[0];", and I expect it would be a 
complete waste of time to suggest standardising on double quotes instead 
of single quotes, and anyway I think single quotes look prettier.

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Saturday, 2 February 2008 22:06:24 UTC