diff --git a/.gitignore b/.gitignore index aa66a8c..b439c63 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ image.jpg /.project /.settings/ +.envrc diff --git a/build.xml b/build.xml index 9376385..984d861 100644 --- a/build.xml +++ b/build.xml @@ -22,10 +22,27 @@ - + - - + + + + + + + + + + + + + + + + + + + @@ -46,11 +63,21 @@ + + Concatenating files:${line.separator}${prettty-sourcefiles}${line.separator}into ${build.dir}/${JS_NAME}... - - + + + + + + + + Concatenating files:${line.separator}${prettty-sourcefiles-allrends}${line.separator}into ${build.dir}/${JS_NAME}... + + @@ -75,7 +102,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + @@ -95,6 +146,20 @@ + + + + + + + + + + + + diff --git a/demo.html b/demo.html index cf53259..b065445 100644 --- a/demo.html +++ b/demo.html @@ -1,4 +1,4 @@ - + @@ -2370,4 +2370,4 @@ body - \ No newline at end of file + diff --git a/src/Renderer.js b/src/Renderer.js index 3513391..834767e 100644 --- a/src/Renderer.js +++ b/src/Renderer.js @@ -58,9 +58,9 @@ _html2canvas.Renderer = function(parseQueue, options){ sortZ(parseQueue.zIndex); - if ( typeof options.renderer._create !== "function" ) { + if ( typeof options._renderer._create !== "function" ) { throw new Error("Invalid renderer defined"); } - return options.renderer._create( parseQueue, options, document, queue, _html2canvas ); + return options._renderer._create( parseQueue, options, document, queue, _html2canvas ); }; diff --git a/src/Util.js b/src/Util.js index 9934691..93971cd 100644 --- a/src/Util.js +++ b/src/Util.js @@ -34,14 +34,20 @@ html2canvas = function( elements, opts ) { flashcanvas: undefined, // path to flashcanvas width: null, height: null, - taintTest: true // do a taint test with all images before applying to canvas - - }; + taintTest: true, // do a taint test with all images before applying to canvas + renderer: "Canvas" + }, renderer; options = _html2canvas.Util.Extend(opts, options); - - options.renderer = options.renderer || _html2canvas.Renderer.Canvas( options ); - + + if (typeof options.renderer === "string" && _html2canvas.Renderer[options.renderer] !== undefined) { + options._renderer = _html2canvas.Renderer[options.renderer]( options ); + } else if (typeof options.renderer === "function") { + options._renderer = options.renderer( options ); + } else { + throw("Unknown renderer"); + } + _html2canvas.logging = options.logging; options.complete = function( images ) { diff --git a/src/renderers/SVG.js b/src/renderers/SVG.js index eb4a8f1..cc34da3 100644 --- a/src/renderers/SVG.js +++ b/src/renderers/SVG.js @@ -135,10 +135,10 @@ _html2canvas.Renderer.SVG = function( options ) { el = doc.createElementNS(svgNS, "image"); el.setAttributeNS(xlinkNS, "xlink:href", renderItem['arguments'][0].src); - el.setAttribute("width", renderItem['arguments'][0].width); - el.setAttribute("height", renderItem['arguments'][0].height); - el.setAttribute("x", renderItem['arguments'][5] - renderItem['arguments'][1]); - el.setAttribute("y", renderItem['arguments'][6] - renderItem['arguments'][2]); + el.setAttribute("width", renderItem['arguments'][7]); + el.setAttribute("height", renderItem['arguments'][8]); + el.setAttribute("x", renderItem['arguments'][5]); + el.setAttribute("y", renderItem['arguments'][6]); el.setAttribute("clip-path", "url(#clipId" + clipId + ")"); // el.setAttribute("xlink:href", );