[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Should texImage2D and texSubImage2D accept more element types?





On Wed, May 30, 2012 at 11:27 AM, Kenneth Russell <kbr@google.com> wrote:

On Wed, May 30, 2012 at 10:35 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
> Right now, they accept only HTMLImageElement, HTMLVideoElement,
> HTMLCanvasElement.
>
> I believe that they should at least accept SVGImageElement in addition to
> those, especially because the SVG WG is trying to align behavior of
> <svg:image> and <html:img>.

I have very little experience with SVG, but looking at
https://svgwg.org/svg2-draft/struct.html#ImageElement (is that the
right place for the current draft), I see no support for CORS. Does
the SVG spec have the same notions of same-origin content, tainting,
etc. that HTML and Canvas do?

-Ken


So I wrote a quick test to see how well this works for the 2d canvas API

Firefox supports drawing an svg image to a canvas but to does not allow any external references inside the svg, even to SAME domain images. It raises a security error rather than allowing the draw and then marking the canvas as "origin-clean = false"

Chrome does not support drawing an svg image to a canvas at all. It raises a security error in all cases.

I feel like SVG support for canvas 2d probably needs to specced and sorted out before we worry about adding it to WebGL.
 
If it works with canvas then you can always do svg->canvas->texture




> In addition to those four, I believe Gecko will also accept the following
> right now:
>
>  SVGFEImageElement
>  HTMLInputElement (when it's an <input type="image">)
>  HTMLObjectElement (when rendering an image)
>
> I'm not sure whether there are use cases for these, offhand.
>
> -Boris
>
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
> unsubscribe public_webgl
> -----------------------------------------------------------
>

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------