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 17427 - <canvas>: drawImage() should accept SVGImageElement (<svg:image>)
Summary: <canvas>: drawImage() should accept SVGImageElement (<svg:image>)
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 enhancement
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-05 20:25 UTC by contributor
Modified: 2016-03-18 08:54 UTC (History)
10 users (show)

See Also:


Attachments

Description contributor 2012-06-05 20:25:39 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Multipage: http://www.whatwg.org/C#2dcontext
Complete: http://www.whatwg.org/c#2dcontext

Comment:
drawImage should accept SVGImageElement

Posted from: 71.184.125.56 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/15.0 Firefox/15.0a1
Comment 1 Boris Zbarsky 2012-06-05 20:26:10 UTC
We're trying to converge <hgml:img> and <svg:image> as much as we can, as I understand.
Comment 2 contributor 2012-07-18 17:43:49 UTC
This bug was cloned to create bug 18220 as part of operation convergence.
Comment 3 Ian 'Hixie' Hickson 2012-09-20 21:41:43 UTC
Is there a spec I can point to that defines the <svg:image> processing model? The stuff like "available", interaction with the network, CORS, event loop, etc?
Comment 4 Cameron McCormack 2012-09-23 01:25:40 UTC
No, but if you can tell me the list of things that I need to define (and what terms to link to from the HTML spec) I'll do the SVG spec changes needed.
Comment 5 Ian 'Hixie' Hickson 2012-11-25 05:17:32 UTC
I don't know exactly what it needs, but here's the equivalent section for the <img> element in HTML:

   http://www.whatwg.org/specs/web-apps/current-work/#the-img-element

The stuff I need for drawImage() specifically is the same stuff as what I need for ImageBitmap, which may be easier to isolate — see the section that says "If image is an img element" here:

   http://www.whatwg.org/specs/web-apps/current-work/#images

...specifically, the equivalents of:

   "completely available"
   "origin"
   "media data"
Comment 6 rcabanie 2013-03-02 22:19:22 UTC
(In reply to comment #5)
> I don't know exactly what it needs, but here's the equivalent section for
> the <img> element in HTML:
> 
>    http://www.whatwg.org/specs/web-apps/current-work/#the-img-element
> 
> The stuff I need for drawImage() specifically is the same stuff as what I
> need for ImageBitmap, which may be easier to isolate — see the section that
> says "If image is an img element" here:
> 
>    http://www.whatwg.org/specs/web-apps/current-work/#images
> 
> ...specifically, the equivalents of:
> 
>    "completely available"
>    "origin"
>    "media data"

I'm not sure that this is needed. The svgsvgelement [1] is like the HTML canvas. The element and all of its descendant are part of the document and available.

1: http://www.w3.org/TR/SVG/struct.html#InterfaceSVGSVGElement
Comment 7 Ian 'Hixie' Hickson 2013-04-12 22:01:37 UTC
We're not talking about <svg:svg>, we're talking about <svg:image>.
Comment 8 rcabanie 2013-04-12 22:27:27 UTC
(In reply to comment #7)
> We're not talking about <svg:svg>, we're talking about <svg:image>.

I didn't catch that. I don't think there's a big demand for such a feature.
Comment 9 Anne 2016-03-16 17:43:30 UTC
bz, it seems this didn't get the interest we need to add this to HTML. Let me know if you want me to reconsider.
Comment 10 Domenic Denicola 2016-03-16 17:45:27 UTC
+junov just in case Chrome is interested in this.
Comment 11 Boris Zbarsky 2016-03-16 18:57:36 UTC
My understanding is that the SVG working group is actively trying to converge its "duplicated" elements with the corresponding HTML ones.  Given that, it seems like we should treat them identically; pretty much anything else is rather author-hostile.

In particular, it seems to me that <svg:image> should use the same processing model as <html:img> and hence this should all be quite straightforward to spec.  And probably implement; in Gecko all the logic is shared and hence the work to support <svg:image> here is tiny; I would be surprised if it's very different in other browsers.
Comment 12 Anne 2016-03-17 04:56:14 UTC
Okay, happy to reconsider. I guess we could check all the places that accept HTMLImageElement and make them accept SVGImageElement too.

I don't think we necessarily need to wait on SVG to sort out their standard if we all know it's supposed to work identically (though we should maybe point that out with a note until things are sorted).

Justin, what do you think?
Comment 13 Justin Novosad 2016-03-17 19:20:41 UTC
Yes, I think this makes sense. To match use cases of HTMLImageElement, I think we should add SVGImageElement to the CanvasImageSource and ImageBitmapSource typedefs, which implies supporting it as an argument to drawImage, createPattern and createImageBitmap.
Comment 14 Anne 2016-03-18 08:54:47 UTC
Created a pull request: https://github.com/whatwg/html/pull/900.