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 11517 - 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 WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P3 enhancement
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: https://www.w3.org/Bugs/Public/show_b...
Whiteboard: canvas RFE
Keywords:
: 11565 17960 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-09 21:51 UTC by contributor
Modified: 2013-03-19 19:38 UTC (History)
7 users (show)

See Also:


Attachments

Description contributor 2010-12-09 21:51:03 UTC
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
Comment 1 Tab Atkins Jr. 2010-12-10 00:53:46 UTC
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.
Comment 2 Ian 'Hixie' Hickson 2011-01-11 05:12:45 UTC
*** Bug 11565 has been marked as a duplicate of this bug. ***
Comment 3 Ian 'Hixie' Hickson 2011-01-11 05:14:14 UTC
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.
Comment 4 Ian 'Hixie' Hickson 2011-01-11 07:11:13 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: 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.
Comment 5 Michael[tm] Smith 2011-08-04 05:04:12 UTC
mass-move component to LC1
Comment 6 Ian 'Hixie' Hickson 2012-02-29 22:25:46 UTC
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.
Comment 7 Sirisian 2012-03-01 17:34:02 UTC
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.
Comment 8 public-rdfa-wg 2013-01-24 06:46:00 UTC
This bug was cloned to create HTML WG bug 19052.
Comment 9 Ian 'Hixie' Hickson 2013-03-18 23:27:18 UTC
This got fixed as part of the ImageBitmap feature. Just create an ImageBitmap object from the ImageData object, and draw that onto the canvas.
Comment 10 Ian 'Hixie' Hickson 2013-03-19 19:38:15 UTC
*** Bug 17960 has been marked as a duplicate of this bug. ***