W3C home > Mailing lists > Public > public-canvas-api@w3.org > October to December 2013

Re: [whatwg] CanvasRenderingContext2D with addPath, currentPath

From: Jürg Lehni <lists@scratchdisk.com>
Date: Fri, 6 Dec 2013 13:31:02 +0100
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>, "public-canvas-api@w3.org" <public-canvas-api@w3.org>
Message-Id: <42506DA0-D31B-4B77-A339-8C7CDF71594E@scratchdisk.com>
To: Rik Cabanier <cabanier@gmail.com>
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@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)
Received on Friday, 6 December 2013 12:31:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:31:55 UTC