Re: [whatwg] Canvas arcTo method

On Mon, Aug 20, 2012 at 8:15 PM, Michael Day <mikeday@yeslogic.com> wrote:

> Hi Rik,
>
>
>  Yes, that is one way of implementing it. This is not specific to arcTo;
>> this happens with all drawing operators.
>>
>
> It is not quite the same with other drawing operators, for example:
>
> ctx.setTransform(...T1...);
> ctx.lineTo(100, 100);
> ctx.setTransform(...T2...);
> ctx.lineTo(100, 100);
>
> This will draw a line from T1*(100,100) to T2*(100,100), and these points
> can be calculated immediately in absolute canvas coordinates, there is no
> need to apply any inverse transformations.
>
> 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.


Yes you can go to absolute canvas coordinates but you need to remember that
the radius is transformed too.


>
>
>  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.
>>
>
> In our case we are rendering to PDF, which cannot change the
> transformation matrix halfway through a path.


I am sure that it's supposed to work. Do you have an example where this is
not the case? (Maybe you're using PDFL?)


> Even if it could, it does not support arc primitives.
>
> But anyway, regardless of the exact details of how the browsers implement
> it, there is the question of how to describe the algorithm to someone such
> that it can be "implemented" with pencil and paper.
>
> Currently it is very non-obvious how arcTo should work when a new
> transform has been applied since the last drawing command.
>
> Best regards,
>
> Michael
>

Received on Tuesday, 21 August 2012 03:47:56 UTC