1
0
aclindsay.com/svgparser/index.php
2011-02-24 12:25:26 -07:00

53 lines
2.3 KiB
PHP

<?php include("../header_top.php"); ?>
<title>SVG Parser - aclindsay.com</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js"></script>
<?php include("../header_bottom.php"); ?>
<div id="content">
<div id="main">
<h2>Convert to Dojo 'dojox.gfx' format from SVG</h2>
<p>The dojox.gfx tool is very powerful, but there is currently no easy way to convert drawings
from SVG into the format. The only existing tool I found was <a href="http://download.dojotoolkit.org/release-1.3.0/dojo-release-1.3.0/dojox/gfx/demos/data/svg2gfx.xsl">an XSL file</a>, which was very simplistic,
but didn't cover many cases (example: gradient transformations). Therefore, if you wanted to use existing SVG
files with dojox.gfx, you had to convert the file by hand. This was extremely tedious, so I have developed a converter tool
with which you may convert existing SVG files into Javascript code ready to be used with dojox.gfx. If you have any comments or
suggestions for improvement, feel free to let me know at dojox dot gfx @t aclindsay D0T com.</p>
<fieldset style="border: solid black 1px;padding: 1em;"><legend>SVG (XML)</legend>
<textarea id="input" rows="10" style="width: 100%" wrap="off"></textarea>
<button onclick="submit()">Convert To Javascript</button>
</fieldset>
<fieldset style="border: solid black 1px;padding: 1em;"><legend>Javascript Code</legend>
<textarea id="response" rows="30" style="width: 100%" wrap="off"></textarea>
</fieldset>
<script type="text/javascript">
function submit(){
var data = dojo.byId("input").value;
dojo.rawXhrPost({
url: "http://aclindsay.com/svgparser/parser/index.php",
handleAs: "text",
postData: data,
// The handle function will be called on a successful response.
handle: function(response, ioArgs) {
console.log("handle: "+response);
dojo.byId("response").value = response;
return response;
}
}, true);
}
</script>
</div>
<div id="sidebar">
<span>Related Links:</span>
<ul>
<li><a href="http://dojotoolkit.org">Dojo Toolkit</a></li>
<li><a href="http://docs.dojocampus.org/dojox/gfx">dojox.gfx Documentation</a></li>
<li><a href="http://www.w3.org/TR/SVG/">W3 SVG Specification</a></li>
</ul>
</div>
</div>
<?php include("../footer.php"); ?>