[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 1:15 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
On 5/30/12 4:03 PM, Gregg Tavares (社用) wrote:
Firefox supports drawing an svg image to a canvas

Hold.  Back up.  You tested an SVG file inside an image.  I'm talking about <svg:image>, which can be pointing to a JPEG or a PNG or whatever, not just to SVG.

okay, my mistake
 

Something like this:

 <svg:image xlink:href="">

What is this?

I just tried that in FF12 with a valid URL, nothing gets displayed

<!DOCTYPE html>
<html>
<body>
<svg:image xlink:ref="test.jpg" />
</body>
</html>

Did you mean this?

<!DOCTYPE html>
<html>
<body>
<svg xmlns = "http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <image width="100" height="100" xlink:href="" />
</svg>

</body>
</html>

Note if I remove the width or height nothing gets displayed.
Also if remove "xmlns:xlink="http://www.w3.org/1999/xlink" I get an error.

I tried this

<!DOCTYPE html>
<html>
<body>
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <image id="foo" width="100" height="100" xlink:href="" />
</svg>

<canvas id="c"></cavnas>
<script>
window.>

function main() {
  var foo = document.getElementById("foo");
  var c = document.getElementById("c");
  var ctx = c.getContext("2d");
  ctx.drawImage(foo, 0, 0);
}
</script>

</body>
</html>
 
And it indeed works in Firefox.

That's not part of the canvas spec AFAICT though
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html



and then using drawImage on it to a 2d canvas works just fine in Gecko.  I can't speak for other UAs.  And yes, there's an issue against the 2d canvas spec to support that, last I checked.


I feel like SVG support for canvas 2d probably needs to specced and
sorted out before we worry about adding it to WebGL.

I'm not talking about SVG support; you're correct that this is a whole separate kettle of fish.  I'm talking about bitmap image support when the bitmap is loaded in an <svg:image> (because your app is perhaps using SVG instead of HTML for its UI).


If it works with canvas then you can always do svg->canvas->texture

Well, yes, but why make people jump through those hoops?

Again, the desired endpoint is that <svg:image> and <html:img> have as few behavior differences as possible, since pretty much all the differences they do have are completely artificial.

-Boris