[whatwg] CanvasRenderingContext2D with addPath, currentPath
Jürg Lehni
lists at scratchdisk.com
Fri Dec 6 04:31:02 PST 2013
Rik,
I read through the whole thread again and realized I've caused some redundancy by asking questions that were already answered. Apologies for that. I understand the reason for the check for non-revertible matrices, and should have seen that example mentioned earlier, as it would have prevented me from drawing false conclusions.
But just to clarify: What you wrote on November 2nd is not how the browsers currently behave:
On Nov 2, 2013, at 01:01 , Rik Cabanier <cabanier at gmail.com> wrote:
> var ctx = ...getContext("2d");
>
> ctx.scale(2, 2);
>
> ctx.moveTo(10, 10);
>
> ctx.lineTo(100, 10);
>
> var p = ctx.currentPath;
>
> Path p would contain a line from (20, 20) to (200, 20)
If I test this, store the currentPath, then reset the CTM, and then use the path to draw, I can confirm that it is drawn in the coordinates specified in code, and does not backe the current CTM in:
ctx.beginPath();
ctx.scale(2, 2);
ctx.moveTo(10, 10);
ctx.lineTo(100, 10);
var p = ctx.currentPath;
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.currentPath = p;
ctx.strokeStyle = '#000';
ctx.lineWidth = 1;
ctx.stroke();
So Path p contains a line from (10, 10) to (100, 10)
More information about the whatwg
mailing list