W3C home > Mailing lists > Public > public-html@w3.org > June 2010

Re: Canvas drawImage question

From: Philip Taylor <pjt47@cam.ac.uk>
Date: Fri, 11 Jun 2010 16:25:16 +0000
Message-ID: <4C12634D.4030307@cam.ac.uk>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: James Graham <jgraham@opera.com>, HTML WG <public-html@w3.org>
Boris Zbarsky wrote:
> On 6/11/10 11:13 AM, James Graham wrote:
>> On 06/11/2010 04:41 PM, Boris Zbarsky wrote:
>>> Gecko also supports HTMLInputElement
>>> (if of type="image"),
>>
>> I asked Hixie about this specific case and he said the reason it wasn't
>> supported was a lack of compelling use cases. I think it would be easy
>> for us to implement, but I don't think that is a good enough reason to
>> allow it.
> 
> [...]
> 
> As far as use cases go, it seems like pretty much any use case using 
> <img> where the <img> is actually semantically meaningful would apply to 
> <input type="image"> too, if that's what your image's semantic meaning 
> is.  Is the claim that there are no real use cases of drawImage with 
> semantically meaningful images?

I can't think of many likely use cases where an image is used both as a 
visible part of the page and on a canvas - I expect that mostly they are 
used only on the canvas, and are constructed with 'new Image()' or <img 
style="display:none">. Supporting <input type="image"> would only be 
useful when the page already has a visible image input and wants to 
reuse it in a canvas.

The only case I think of is a page using <img src="..." 
class="magic-canvas-effect"> and importing a library that replaces 
images with special-effected versions of the image. That could probably 
work fine with <input type="image"> (by setting 
input.src=canvas.toDataURL() instead of actually replacing the element), 
though it wouldn't be much harder for the library to grab input.src and 
load it into an Image if it couldn't draw the input element directly 
onto the canvas. Are there more cases of wanting to draw elements 
already in the page onto a canvas?

(Currently drawImage's behaviour for not-yet-loaded images is defined in 
terms of the "complete" attribute, which seems to only exist on 
HTMLImageElement and not HTMLInputElement, so that behaviour would have 
to be defined differently if new image sources are added.)

-- 
Philip Taylor
pjt47@cam.ac.uk
Received on Saturday, 12 June 2010 02:17:45 UTC

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