source: Dev/trunk/src/client/dojox/gfx/tests/test_image2.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 2.1 KB
Line 
1<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2<head>
3<title>Testing image</title>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
6<!--<script type="text/javascript" src="../vml.js"></script>-->
7<!--<script type="text/javascript" src="../svg.js"></script>-->
8<!--<script type="text/javascript" src="../silverlight.js"></script>-->
9<script type="text/javascript">
10dojo.require("dojox.gfx");
11
12var grid_size = 500, grid_step = 50;
13var main = null, g = null, image = null, rect = null;
14
15createSurface = function(){
16        var surface = dojox.gfx.createSurface("test", 800, 600);
17        surface.whenLoaded(makeShapes);
18};
19
20makeShapes = function(s){
21        for(var i = 0; i <= grid_size; i += grid_step){
22                s.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("black");
23                s.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("black");
24        }
25
26        main = s.createGroup();
27        rect = main.createRect({x: 0, y: 0, width: 200, height: 200}).setStroke("black").setFill(new dojo.Color([255, 0, 255, 0.5]));
28        rect.connect("onclick", function(){ alert("rect"); })
29   
30        image = s.createImage({width: 150, height: 100, src: "images/eugene-sm.jpg"});
31        image.connect("onclick", function(){ alert("image"); })
32       
33        main.add(image);
34       
35        // static images to see how the size
36
37        s.createImage({x: 0,   y: 200, width: 150, height: 100, src: "images/eugene-sm.jpg"});
38        s.createImage({x: 0,   y: 300, width: 300, height: 100, src: "images/eugene-sm.jpg"});
39        s.createImage({x: 300, y: 200, width: 150, height: 200, src: "images/eugene-sm.jpg"});
40       
41        main.moveToFront();
42};
43
44trans = function(){
45        var x = 1;
46        main.setTransform([dojox.gfx.matrix.rotategAt(45, 200, 200), {dx: 200, dy: 200}]);
47};
48
49dojo.addOnLoad(createSurface);
50
51</script>
52</head>
53<body>
54<p>Testing image:<br /><button onclick="trans();">Trans</button></p>
55<p>Note: Silverlight doesn't allow downloading images when run from a file system. This demo should be run from a server.</p>
56<div id="test"></div>
57<p>That's all Folks!</p>
58</body>
59</html>
Note: See TracBrowser for help on using the repository browser.