This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19052 - Since context.putImageData() does not handle compositing, another set of methods, maybe context.drawImageData(), should be created to allow ImageData objects to be drawn onto the canvas in the same fashion as Image objects.
Summary: Since context.putImageData() does not handle compositing, another set of meth...
Status: RESOLVED LATER
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML Canvas 2D Context (show other bugs)
Version: unspecified
Hardware: All All
: P3 enhancement
Target Milestone: ---
Assignee: Jay Munro
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-25 22:00 UTC by contributor
Modified: 2013-02-22 18:46 UTC (History)
7 users (show)

See Also:


Attachments

Description contributor 2012-09-25 22:00:47 UTC
This was was cloned from bug 11517 as part of operation LATER convergence.
Originally filed: 2010-12-09 21:51:00 +0000

================================================================================
 #0   contributor@whatwg.org                          2010-12-09 21:51:03 +0000 
--------------------------------------------------------------------------------
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Section: http://www.whatwg.org/specs/web-apps/current-work/complete.html#pixel-manipulation

Comment:
Since context.putImageData() does not handle compositing, another set of
methods, maybe context.drawImageData(), should be created to allow ImageData
objects to be drawn onto the canvas in the same fashion as Image objects.

Posted from: 173.186.242.11
================================================================================
 #1   Tab Atkins Jr.                                  2010-12-10 00:53:46 +0000 
--------------------------------------------------------------------------------
If you want to composite a whole canvas onto another canvas, you can just use the first canvas as an argument to drawImage().  If you want to composite a portion of a canvas onto another canvas, you can first use putImageData to draw the portion onto a *third*, appropriately sized, canvas, and then use drawImage with the third canvas.
================================================================================
 #2   Ian 'Hixie' Hickson                             2011-01-11 05:12:45 +0000 
--------------------------------------------------------------------------------
*** Bug 11565 has been marked as a duplicate of this bug. ***
================================================================================
 #3   Ian 'Hixie' Hickson                             2011-01-11 05:14:14 +0000 
--------------------------------------------------------------------------------
bug 11565 had the following use case description:

---------
Usage scenario. You have a large image that you want to render a portion to the
screen without overwriting the whole canvas. (Pretend part of it is
transparent). You also want the ability to change pixel info quickly and
ImageData allows that.
---------

However, I don't really understand what that means.
================================================================================
 #4   Ian 'Hixie' Hickson                             2011-01-11 07:11:13 +0000 
--------------------------------------------------------------------------------
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: Rejected
Change Description: no spec change
Rationale: I discussed this with Sirisian (bug 11565's reporter) on IRC. In conclusion, it isn't clear to me that there is an urgent compelling need for this. I've marked this bug LATER so that we can study it again in the future.
================================================================================
 #6   Ian 'Hixie' Hickson                             2012-02-29 22:25:46 +0000 
--------------------------------------------------------------------------------
I'll look at this again when dealing with high-res putImageData().

In general though it's not clear to me why drawImage() isn't already sufficient here.
================================================================================
 #7   Sirisian                                        2012-03-01 17:34:02 +0000 
--------------------------------------------------------------------------------
I can't really remember why I suggested this. It was probably because of a performance problem when rendering images. That is to say the intended implementation of drawImageData would composite but only on integer values so as to not take the performance hit that drawImage has when the x and y values are rational and there is no transformation applied. However, a drawImage implementation could special case for that to draw faster so such a method for drawImageData seems pointless. The other perceived problem was handling of alpha values that are binary either on or off. drawImageData would ideally be designed to render only pixels with an alpha that isn't 0 so that no performance is lost due to a software blending function. That is to say the implementation of drawImageData would be identical to putImageData except it would not copy pixels that have an alpha value of 0. Kind of a random proposition for the sake of a sane and fast implementation. More of an edge case in the usage of canvas.
================================================================================