test_image2.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. <!--
  6. The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
  7. <script type="text/javascript" src="Silverlight.js"></script>
  8. -->
  9. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
  10. <!--<script type="text/javascript" src="../vml.js"></script>-->
  11. <!--<script type="text/javascript" src="../svg.js"></script>-->
  12. <!--<script type="text/javascript" src="../silverlight.js"></script>-->
  13. <script type="text/javascript">
  14. dojo.require("dojox.gfx");
  15. var grid_size = 500, grid_step = 50;
  16. var main = null, g = null, image = null, rect = null;
  17. makeShapes = function(){
  18. var s = dojox.gfx.createSurface("test", 800, 600);
  19. for(var i = 0; i <= grid_size; i += grid_step){
  20. s.createLine({x1: 0, x2: grid_size, y1: i, y2: i}).setStroke("black");
  21. s.createLine({y1: 0, y2: grid_size, x1: i, x2: i}).setStroke("black");
  22. }
  23. main = s.createGroup();
  24. //rect = main.createRect({x: 0, y: 0, width: 100, height: 100}).setStroke("black").setFill(new dojo.Color([255, 0, 255, 0.5]));
  25. image = main.createImage({width: 157, height: 53, src: "http://archive.dojotoolkit.org/nightly/checkout/util/resources/dojotoolkit.org/mini-dtk/images/logo.png"});
  26. // comment out the next string to see the problem
  27. rect = main.createRect({x: 0, y: 0, width: 100, height: 100}).setStroke("black").setFill(new dojo.Color([255, 0, 255, 0.5]));
  28. //g = main.createGroup();
  29. //g.createRect({x: 0, y: 0, width: 100, height: 100}).setStroke("black").setFill(new dojo.Color([255, 255, 0, 0.5]));
  30. };
  31. trans = function(){
  32. var x = 1;
  33. main.setTransform([dojox.gfx.matrix.rotategAt(45, 200, 200), {dx: 200, dy: 200}]);
  34. };
  35. dojo.addOnLoad(makeShapes);
  36. </script>
  37. </head>
  38. <body>
  39. <p>Testing image:<br /><button onclick="trans();">Trans</button></p>
  40. <p>Note: Silverlight doesn't allow downloading images when run from a file system. This demo should be run from a server.</p>
  41. <div id="test"></div>
  42. <p>That's all Folks!</p>
  43. </body>
  44. </html>