Skip to content

Commit

Permalink
Added new canvg test file.
Browse files Browse the repository at this point in the history
  • Loading branch information
bramp committed May 19, 2013
1 parent 86b941a commit af152d7
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions test/canvg.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
</head>

<textarea id="language" rows="10" cols="50">
#Note left of A: Note to the\n left of A
#Note right of A: Note to the\n right of A
#Note over A: Note over A
Note over A,B: Note over A,B
</textarea>
<button id="parse" type="button">Click Me!</button>
<div>
SVG:
<div id="diagram"></div>
</div>

<div>
Canvas:
<canvas id="canvas" width="1000px" height="600px"></canvas>
</div>

<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/StackBlur.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<!--script src="underscore-min.js"></script-->
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>

<script src="../build/sequence-diagram-min.js"></script>
<script>
$(document).ready(function(){
$('#parse').click(_.throttle( function() {

var diagram = Diagram.parse($('#language').val());
console.log(diagram);

diagram.drawSVG('diagram', {theme: 'hand'});

// Test canvg
var data = document.getElementById('diagram').childNodes[0]; //svg data
var s = new XMLSerializer();
var str = s.serializeToString(data); //convert SVG code to string
canvg(document.getElementById('canvas'), str); //drawing the svg on the canvas

}, 100));
});
</script>
</body>
</html>



0 comments on commit af152d7

Please sign in to comment.