W3C home > Mailing lists > Public > public-html@w3.org > December 2011

[Bug 15255] New: CanvasRenderingContext2D.getContext() would be quite awesome

From: <bugzilla@jessica.w3.org>
Date: Sat, 17 Dec 2011 13:25:29 +0000
To: public-html@w3.org
Message-ID: <bug-15255-2495@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15255

           Summary: CanvasRenderingContext2D.getContext() would be quite
                    awesome
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HTML Canvas 2D Context (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: mikemp@mit.edu
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


Feature request:
CanvasRenderingContext2D.getTransform() returns an Array[6] of the current
transformation matrix.

This was brought up previously:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-July/027394.html

The previous request did not receive any public comments, and I'd like to
re-prompt the request for reasons not mentioned.

getTransform would allow authors to copy transformation state from one context
to another as needed. This is particularly relevant in code that coordinates
graphics among multiple canvases (save/restore is not applicable).

For example:

(1) Authors could save a reused canvas alongside its context2d transform,
compute the bitmap's bounding geometry from the transform, and later decide
whether the bitmap should be redrawn based on its geometry.

(2) Similarly, redrawing the bitmap onto a new canvas with the same transform 
requires portability of the original state.

(3) getTransform allows for general purpose math operations. For example, if
the author wants to know over which pixel in a canvas bitmap the cursor is
hovering: simply getTransform(), invert the matrix, and multiply with the
cursor to get the pixel index.

A workaround I wrote can be found here:
http://gitorious.org/meta2d/core/blobs/master/src/context.js

The same repository contains examples that give a context (no pun intended) to
the utility of getTransform. It would be nice to do this without a cludge, and
get back some CPU.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Saturday, 17 December 2011 15:24:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:29 UTC