From fd5b3f52cfefb3c400e2f68167c65598f0a1f269 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Tue, 31 Aug 2010 13:44:05 +0000 Subject: [PATCH] Updated canvg and put PNG export in canvg callback git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1692 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/canvg/canvg.js | 100 ++++++++++++++++++++++++++---------------- editor/svg-editor.js | 7 +-- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/editor/canvg/canvg.js b/editor/canvg/canvg.js index c67269ec..bc0d9e37 100644 --- a/editor/canvg/canvg.js +++ b/editor/canvg/canvg.js @@ -31,6 +31,8 @@ if(!Array.indexOf){ // opts: optional hash of options // ignoreMouse: true => ignore mouse events // ignoreAnimation: true => ignore animations + // 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 this.canvg = function (target, s, opts) { if (typeof target == 'string') { target = document.getElementById(target); @@ -69,6 +71,7 @@ if(!Array.indexOf){ svg.Definitions = {}; svg.Styles = {}; svg.Animations = []; + svg.Images = []; svg.ctx = ctx; svg.ViewPort = new (function () { this.viewPorts = []; @@ -86,6 +89,14 @@ if(!Array.indexOf){ }); } svg.init(); + + // images loaded + svg.ImagesLoaded = function() { + for (var i=0; i