canvg-master
svg canvg 

所属分类:图形图象
开发工具:JavaScript
文件大小:2098KB
下载次数:2
上传日期:2016-02-02 15:49:04
上 传 者lvjian467906351
说明:  Canvg图形转换工具,将图表转换SVG,在转换图片
(Graphics conversion tool, conversion chart SVG, image conversion)

文件列表:
MIT-LICENSE.txt (1155, 2015-07-19)
StackBlur.js (18417, 2015-07-19)
bower.json (231, 2015-07-19)
canvg.js (105220, 2015-07-19)
component.json (366, 2015-07-19)
examples (0, 2015-07-19)
examples\callback.htm (1944, 2015-07-19)
examples\convert.htm (31566, 2015-07-19)
examples\flashcanvas.js (9514, 2015-07-19)
examples\flashcanvas.swf (20085, 2015-07-19)
examples\index.htm (14677, 2015-07-19)
package.json (553, 2015-07-19)
rgbcolor.js (7901, 2015-07-19)
svgs (0, 2015-07-19)
svgs\1.svg (2927, 2015-07-19)
svgs\10.svg (327, 2015-07-19)
svgs\11.svg (340, 2015-07-19)
svgs\12.svg (348, 2015-07-19)
svgs\13.svg (342, 2015-07-19)
svgs\14.svg (284, 2015-07-19)
svgs\15.svg (621, 2015-07-19)
svgs\16.svg (566, 2015-07-19)
svgs\17.svg (562, 2015-07-19)
svgs\18.svg (580, 2015-07-19)
svgs\19.svg (580, 2015-07-19)
svgs\2.svg (1429, 2015-07-19)
svgs\20.svg (428, 2015-07-19)
svgs\21.svg (873, 2015-07-19)
svgs\22.svg (1633340, 2015-07-19)
svgs\23.svg (96719, 2015-07-19)
svgs\24.svg (1849, 2015-07-19)
svgs\25.svg (31187, 2015-07-19)
svgs\26.svg (62062, 2015-07-19)
svgs\27.svg (1410, 2015-07-19)
svgs\28.svg (4128, 2015-07-19)
svgs\29.svg (1660, 2015-07-19)
svgs\3.svg (335, 2015-07-19)
svgs\30.svg (859, 2015-07-19)
... ...

Introduction ============ canvg is a SVG parser and renderer. It takes a URL to a SVG file or the text of an SVG file, parses it in JavaScript, and renders the result on a [Canvas](http://dev.w3.org/html5/2dcontext/) element. The rendering speed of the examples is about as fast as native SVG. What's implemented? =================== The end goal is everything from the [SVG spec](http://www.w3.org/TR/SVG/). The majority of the rendering and animation is working. If you would like to see a feature implemented, don't hesitate to contact me or add it to the issues list. Potential uses =============== * Allows for inline embedding of SVG through JavaScript (w/o having to request another file or break validation) * Allows for single SVG version across all browsers that support Canvas * Allows for mobile devices supporting Canvas but not SVG to render SVG * Allows for SVG -> Canvas -> png transition all on the client side (through [toDataUrl](http://www.w3.org/TR/html5/the-canvas-element.html#dom-canvas-todataurl)) Example Demonstration ===================== [view here](http://gabelerner.github.io/canvg/examples/index.htm) Tested in Chrome, Firefox, Opera, and IE (through FlashCanvas) [jsfiddle playground](http://jsfiddle.net/L3hondLn/) Usage ===== Include the following files in your page: ```html ``` Put a canvas on your page ```html ``` Example canvg calls: ```html ``` The third parameter is options: * log: true => console.log information * ignoreMouse: true => ignore mouse events * ignoreAnimation: true => ignore animations * ignoreDimensions: true => does not try to resize canvas * ignoreClear: true => does not clear canvas * offsetX: int => draws at a x offset * offsetY: int => draws at a y offset * scaleWidth: int => scales horizontally to width * scaleHeight: int => scales vertically to height * renderCallback: function => will call the function after the first render is completed * forceRedraw: function => will call the function on every frame, if it returns true, will redraw * useCORS: true => will attempt to use CORS on images to not taint canvas You can call canvg without parameters to replace all svg images on a page. See the [example](http://gabelerner.github.io/canvg/examples/convert.htm). There is also a built in extension method to the canvas context to draw svgs similar to the way [drawImage](http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage) works: ```javascript var c = document.getElementById('canvas'); var ctx = c.getContext('2d'); ctx.drawSvg(SVG_XML_OR_PATH_TO_SVG, dx, dy, dw, dh); ``` Related Repositories ==================== * [Output javascript instead of rendering to canvas](http://code.google.com/p/jscapturecanvas/) * [A combo of canvg & jscapturecanvas to compile SVG to Canvas (Server side)](https://github.com/nathan-muir/canvgc) * [Edit SVG files in your browser](https://code.google.com/p/svg-edit/)

近期下载者

相关文件


收藏者