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

[Bug 11566] Image should have getContext(...) just like canvas

From: <bugzilla@jessica.w3.org>
Date: Tue, 11 Jan 2011 19:19:01 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1PcjkD-0003gW-V5@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11566

Ian 'Hixie' Hickson <ian@hixie.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ian@hixie.ch
         Resolution|                            |FIXED

--- Comment #1 from Ian 'Hixie' Hickson <ian@hixie.ch> 2011-01-11 19:19:01 UTC ---
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the tracker issue; or you may create a tracker issue
yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: none yet
Rationale: We'll probably add a way to get image data straight from a
same-origin image in a future version (it's a little late in the cycle to add
features right now), so I've marked this LATER.

In the meantime, though, why is "having to generate new canvases" a problem?
It's only five extra lines of code, which are easily put into a utility
function and forgotten:

image.onload = function()
{
    var canvas = document.createElement('canvas');
    canvas.width = image.width;
    canvas.height = image.height;
    var context = canvas.getContext("2d");
    context.drawImage(image, 0, 0);
    imageData = context.getImageData(0, 0, image.width, image.height);
}

If you do this a lot, you can also just have a scratch canvas around for this
purpose, already sized to the max of all the incoming images.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Tuesday, 11 January 2011 19:19:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 19:19:04 GMT