Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cobexer/html2canvas
...
head fork: cobexer/html2canvas
Checking mergeability… Don't worry, you can still create the pull request.
  • 9 commits
  • 6 files changed
  • 0 commit comments
  • 4 contributors
Commits on Apr 17, 2012
Paolo Fixed support for other Renderers other than Canvas 8d96502
Paolo Fixed image rendering in SVG renderer cfc45e4
Paolo Added direnv conf file to .gitignore d494b8d
Binduck Minor changes de1d1d7
Commits on Apr 23, 2012
Bdkzero Fixed custom renderer option a5969be
Commits on May 08, 2012
Bdkzero Prebuilt distribution files 98bc1f0
Commits on May 20, 2012
Bdkzero Readded /build/ directory to .gitignore and removed /build directory 00c3fb7
Bdkzero Created new build target 'build-allrends'. Use this to build html2can…
…vas including all renderers
17f4701
Commits on May 22, 2012
@niklasvh niklasvh Merge pull request #92 from bdkzero/master
Support for other renderers than Canvas and fixed image rendering in SVG renderer
16022b8
View
1  .gitignore
@@ -9,3 +9,4 @@
image.jpg
/.project
/.settings/
+.envrc
View
77 build.xml
@@ -22,10 +22,27 @@
<file name="Queue.js"/>
<file name="Renderer.js"/>
<file name="Util.js"/>
- <file name="renderers/Canvas.js"/>
+ <file name="renderers/Canvas.js"/>
<file name="html2canvas-post.txt"/>
- </filelist>
- </path>
+ </filelist>
+ </path>
+
+ <path id="sourcefiles-allrends">
+ <filelist dir="${src.dir}">
+ <file name="LICENSE"/>
+ <file name="html2canvas-pre.txt"/>
+ <file name="Core.js"/>
+ <file name="Generate.js"/>
+ <file name="Parse.js"/>
+ <file name="Preload.js"/>
+ <file name="Queue.js"/>
+ <file name="Renderer.js"/>
+ <file name="Util.js"/>
+ <file name="renderers/Canvas.js"/>
+ <file name="renderers/SVG.js"/>
+ <file name="html2canvas-post.txt"/>
+ </filelist>
+ </path>
<path id="jquery-plugin">
<fileset dir="${src.dir}" includes="LICENSE"/>
@@ -46,11 +63,21 @@
</target>
<pathconvert property="prettty-sourcefiles" pathsep="${line.separator}" refid="sourcefiles"></pathconvert>
+
+ <pathconvert property="prettty-sourcefiles-allrends" pathsep="${line.separator}" refid="sourcefiles-allrends"></pathconvert>
<target name="build" depends="build-dir,plugins">
<echo>Concatenating files:${line.separator}${prettty-sourcefiles}${line.separator}into ${build.dir}/${JS_NAME}...</echo>
- <concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
- <path refid="sourcefiles"/>
+ <concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
+ <path refid="sourcefiles"/>
+ </concat>
+ <replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" />
+ </target>
+
+ <target name="build-allrends" depends="build-dir,plugins">
+ <echo>Concatenating files:${line.separator}${prettty-sourcefiles-allrends}${line.separator}into ${build.dir}/${JS_NAME}...</echo>
+ <concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
+ <path refid="sourcefiles-allrends"/>
</concat>
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" />
</target>
@@ -75,7 +102,31 @@
<file name="Queue.js"/>
<file name="Renderer.js"/>
<file name="Util.js"/>
- <file name="renderers/Canvas.js"/>
+ <file name="renderers/Canvas.js"/>
+ </sources>
+ </jscomp>
+ <delete file="${build.dir}/${JS_NAME_MIN}.tmp"></delete>
+ </target>
+
+ <target name="syntaxcheck-allrends" depends="build-dir,build-allrends">
+ <jscomp compilationLevel="simple" warning="verbose"
+ debug="false"
+ output="${build.dir}/${JS_NAME_MIN}.tmp">
+ <externs dir="${lib.dir}">
+ <file name="${jquery-externs}"/>
+ </externs>
+ <sources dir="${src.dir}">
+ <!-- need to write them again here since the closure compiler doesn't understand filesets,... -->
+ <file name="LICENSE"/>
+ <file name="Core.js"/>
+ <file name="Generate.js"/>
+ <file name="Parse.js"/>
+ <file name="Preload.js"/>
+ <file name="Queue.js"/>
+ <file name="Renderer.js"/>
+ <file name="Util.js"/>
+ <file name="renderers/Canvas.js"/>
+ <file name="renderers/SVG.js"/>
</sources>
</jscomp>
<delete file="${build.dir}/${JS_NAME_MIN}.tmp"></delete>
@@ -95,6 +146,20 @@
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" />
</target>
+ <target name="release-allrends" depends="build-dir,build-allrends,syntaxcheck-allrends">
+ <jscomp compilationLevel="simple" warning="verbose"
+ debug="false"
+ output="${build.dir}/${JS_NAME_MIN}">
+ <externs dir="${lib.dir}">
+ <file name="${jquery-externs}"/>
+ </externs>
+ <sources dir="${build.dir}">
+ <file name="${JS_NAME}"/>
+ </sources>
+ </jscomp>
+ <replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" />
+ </target>
+
<target name="clean">
<delete dir="${build.dir}"></delete>
</target>
View
4 demo.html
@@ -1,4 +1,4 @@
-<html>
+<html>
<head>
<script type="text/javascript" src="external/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="build/html2canvas.js"></script>
@@ -2370,4 +2370,4 @@
<div class="copyright">
&copy;Copyright Max Design 2010
</div>
-</body></html>
+</body></html>
View
4 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 );
};
View
18 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 ) {
View
8 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", );

No commit comments for this range

Something went wrong with that request. Please try again.