56 lines
2.4 KiB
PHP
56 lines
2.4 KiB
PHP
<?php
|
|
include_once("../common.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 <a href="<?php echo get_base_url(); ?>/contact">contact me</a>.</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: "<?php echo get_base_url(); ?>/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"); ?>
|