75 lines
3.4 KiB
HTML
75 lines
3.4 KiB
HTML
|
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
|
|||
|
<head>
|
|||
|
<title>Testing image</title>
|
|||
|
<style type="text/css">
|
|||
|
@import "../../../dojo/resources/dojo.css";
|
|||
|
@import "../../../dijit/tests/css/dijitTests.css";
|
|||
|
</style>
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|||
|
<!--
|
|||
|
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
|
|||
|
<script type="text/javascript" src="Silverlight.js"></script>
|
|||
|
-->
|
|||
|
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
|
|||
|
<!--<script type="text/javascript" src="../vml.js"></script>-->
|
|||
|
<!--<script type="text/javascript" src="../svg.js"></script>-->
|
|||
|
<!--<script type="text/javascript" src="../silverlight.js"></script>-->
|
|||
|
<script type="text/javascript">
|
|||
|
dojo.require("dojox.gfx");
|
|||
|
|
|||
|
var image = null;
|
|||
|
var grid_size = 500;
|
|||
|
var grid_step = 50;
|
|||
|
|
|||
|
makeShapes = function(){
|
|||
|
var surface = dojox.gfx.createSurface("test", 800, 600);
|
|||
|
for(var i = 0; i <= grid_size; i += grid_step){
|
|||
|
surface.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("black");
|
|||
|
surface.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("black");
|
|||
|
}
|
|||
|
image = surface.createImage({width: 157, height: 53, src: "http://archive.dojotoolkit.org/nightly/checkout/util/resources/dojotoolkit.org/mini-dtk/images/logo.png"});
|
|||
|
//dojo.connect(image.getEventSource(), "onclick", function(){ alert("You didn't expect a download, did you?"); });
|
|||
|
image.connect("onclick", function(){ alert("You didn't expect a download, did you?"); });
|
|||
|
};
|
|||
|
|
|||
|
transformImage = function(){
|
|||
|
var radio = document.getElementsByName("switch");
|
|||
|
if(radio[0].checked){
|
|||
|
image.setTransform({});
|
|||
|
}else if(radio[1].checked){
|
|||
|
image.setTransform(dojox.gfx.matrix.translate(100,100));
|
|||
|
}else if(radio[2].checked){
|
|||
|
image.setTransform([dojox.gfx.matrix.translate(100,0), dojox.gfx.matrix.rotateg(45)]);
|
|||
|
}else if(radio[3].checked){
|
|||
|
image.setTransform([dojox.gfx.matrix.translate(70,90), dojox.gfx.matrix.scale({x:1.5, y:0.5})]);
|
|||
|
}else if(radio[4].checked){
|
|||
|
image.setTransform([dojox.gfx.matrix.rotateg(15), dojox.gfx.matrix.skewXg(-30)]);
|
|||
|
}
|
|||
|
var cb = document.getElementById("r2");
|
|||
|
if(cb.checked && !image.getShape().x){
|
|||
|
image.setShape({x: 100, y: 50});
|
|||
|
}else if(!cb.checked && image.getShape().x){
|
|||
|
image.setShape({x: 0, y: 0});
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
dojo.addOnLoad(makeShapes);
|
|||
|
|
|||
|
</script>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<h1>dojox.gfx Image tests</h1>
|
|||
|
<p>Note: Silverlight doesn't allow downloading images when run from a file system. This demo should be run from a server.</p>
|
|||
|
<p>
|
|||
|
<input type="radio" name="switch" id="r1_reset" checked onclick="transformImage()" /><label for="r1_reset">Reset Image</label><br />
|
|||
|
<input type="radio" name="switch" id="r1_move" onclick="transformImage()" /><label for="r1_move">Move Image</label><br />
|
|||
|
<input type="radio" name="switch" id="r1_rotate" onclick="transformImage()" /><label for="r1_rotate">Rotate Image</label><br />
|
|||
|
<input type="radio" name="switch" id="r1_scale" onclick="transformImage()" /><label for="r1_scale">Scale Image</label><br />
|
|||
|
<input type="radio" name="switch" id="r1_skew" onclick="transformImage()" /><label for="r1_skew">Skew Image</label><br />
|
|||
|
</p>
|
|||
|
<p><input type="checkbox" id="r2" onclick="transformImage()" /><label for="r2">Offset image by (100, 50)</label></p>
|
|||
|
<div id="test"></div>
|
|||
|
<p>That's all Folks!</p>
|
|||
|
</body>
|
|||
|
</html>
|