html5 - Drawing SVG in <canvas>: simplest way to do it? -


I am trying to draw a SVG image on a canvas element. Some sources found that I should use a special library to convert the SVG data into and strokes, while others say that I just have to drawImage () can use a SVG image to drag it to a canvas.

At first I used the canvg library to attract my SVG to the canvas, but I felt that it is very rich and more specialty for my simple needs. Although heavy, the use of a simple drawImage call does not appear in my application: nothing is displayed. If I change the reseller URL of a PNG image of my SVG, it shows precisely. what is wrong? Am I doing anything wrong or SVG coming on the canvas is no longer supported like this?

I have tried to do it in Chrome 21, 22-Canary and Opera.

My code (in the coffee script):

  ctx = @ canvas.getContext '2d' ctx.clear0, 0, @ canvas.width, @canvas.height ctx .drawImg @image, 0, 0, @ Canvas.width, @ canvas.height  

If

indicates a code, if not, then SVG

< / P>


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -