[whatwg] Canvas arcTo method
Rik Cabanier
cabanier at gmail.com
Mon Aug 20 19:53:37 PDT 2012
On Mon, Aug 20, 2012 at 5:55 PM, Michael Day <mikeday at yeslogic.com> wrote:
> Hi Rik,
>
> The 'scale(2,1)' set up a different coordinate system. You can rewrite
>> your code from this:
>>
>> ctx.lineTo(100, 100);
>> ctx.scale(2, 1);
>> ctx.arcTo(100, 100, 100, 200, 100);
>>
>> to this:
>>
>> ctx.scale(2, 1);
>> *ctx.lineTo(50, 100);*
>>
>> ctx.arcTo(100, 100, 100, 200, 100);
>>
>
> Right, these will produce the same arc. But how should this be implemented
> in the user agent?
>
> It's almost like it is getting the last point in the previous subpath,
> transforming it by the inverse of the current transformation matrix,
> generating the arc, and then transforming the arc by the matrix.
>
Yes, that is one way of implementing it. This is not specific to arcTo;
this happens with all drawing operators.
>
> Is this what Firefox and Chrome do? There is no hint of this in the spec,
> which is quite ambiguous about how the current transform should affect
> previous subpaths.
>
I don't know. It just depends how they implemented in. They might apply the
CTM to all the coordinates or keep the coordinates and pass them along with
the CTM to the drawing system.
More information about the whatwg
mailing list