W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] Canvas arcTo method

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 3 Sep 2012 15:58:57 +0000 (UTC)
To: Michael Day <mikeday@yeslogic.com>, Rik Cabanier <cabanier@gmail.com>
Message-ID: <Pine.LNX.4.64.1209031544030.30734@ps20323.dreamhostps.com>
Cc: whatwg@lists.whatwg.org
On Mon, 20 Aug 2012, Michael Day wrote:
> 
> The camvas arcTo method generates an arc that touches two tangent lines. 
> The first tangent line is from the last point in the previous subpath to 
> the first point passed to the arcTo method.
> 
> What happens in this situation:
> 
> ctx.lineTo(100, 100);
> ctx.scale(2, 1);
> ctx.arcTo(100, 100, 100, 200, 100);
> 
> The current transformation matrix should be used to transform the 
> generated arc, not to transform its control points.

The intent is that the whole thing be done in the transformed coordinate 
space. The spec was rather poorly written, I've made it slightly better 
(though only minimally so... I'm not really sure how to write the spec to 
be both clear and accurate).


On Tue, 21 Aug 2012, Michael Day wrote:
> 
> For arcTo, it's much less obvious how the arc should be generated from 
> the three control points, when the first control point is transformed by 
> a different matrix to the last two; in this case you cannot just 
> remember the three points in absolute canvas coordinates, but the 
> specification does not clarify this.

Does it work if you just transform all the points and the line?

(Yeah, that's still way too vague. I'm not sure how to really specify 
this in a manner that's both unambiguous and clear. Any suggestions?)


On Tue, 21 Aug 2012, Michael Day wrote:
> 
> You cannot transform the three control points, and then generate the 
> arc. If you do this, you will always get circular arcs, whereas a 
> scale(2, 1) will produce an elliptical arc. You have to generate the 
> arc, then scale it.

Yeah, that's why the spec hand-waves to transform the line too... but I 
agree that that doesn't really work.

Do you have any suggestion of how to spec this better?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 3 September 2012 15:59:28 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC