Created
August 25, 2011 14:34
-
-
Save runeb/1170801 to your computer and use it in GitHub Desktop.
Export the paper.js view as SVG by rendering to http://svgkit.sourceforge.net/web/SVGCanvas.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SVGCanvas.prototype.transform = SVGCanvas.prototype.translate; | |
// SVGCanvas.prototype.fillText = SVGCanvas.prototype.text; | |
paper.View.prototype.toSVG = function() { | |
var svgContext = new SVGCanvas(this.canvas.width, this.canvas.height); | |
var oldCtx = this._context; | |
this._context = svgContext; | |
this.draw(false); | |
this._context = oldCtx; | |
// Optional serialization of the SVG DOM nodes | |
var serializer = new XMLSerializer(); | |
return serializer.serializeToString(svgContext.svg.htmlElement); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment