test_setPath.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
  2. <head>
  3. <title>Testing setPath and curves</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <style type="text/css">
  6. @import "../../../dojo/resources/dojo.css";
  7. @import "../../../dijit/tests/css/dijitTests.css";
  8. </style>
  9. <!--
  10. The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
  11. <script type="text/javascript" src="Silverlight.js"></script>
  12. -->
  13. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
  14. <!--<script type="text/javascript" src="../path.js"></script>-->
  15. <!--<script type="text/javascript" src="../vml.js"></script>-->
  16. <!--<script type="text/javascript" src="../svg.js"></script>-->
  17. <!--<script type="text/javascript" src="../silverlight.js"></script>-->
  18. <script type="text/javascript">
  19. dojo.require("dojox.gfx");
  20. makeShapes = function(){
  21. var surface = dojox.gfx.createSurface("test", 500, 500);
  22. // relative path with cubic beziers
  23. surface
  24. .createPath("m100 100 100 0 0 100c0 50-50 50-100 0s-50-100 0-100z")
  25. .setStroke({color: "blue"})
  26. .setFill("#ddd")
  27. .setTransform({dx: -50, dy: -50})
  28. ;
  29. // absolute path with cubic bezier
  30. surface
  31. .createPath("M100 100 200 100 200 200C200 250 150 250 100 200S50 100 100 100z")
  32. .setStroke({color: "blue"})
  33. .setFill("#ddd")
  34. .setTransform({dx: 100, dy: -50})
  35. ;
  36. // relative path with horizontal and vertical lines, and cubic beziers
  37. surface
  38. .createPath("m100 100h100v100c0 50-50 50-100 0s-50-100 0-100z")
  39. .setStroke({color: "blue"})
  40. .setFill("#ddd")
  41. .setTransform({dx: 250, dy: -50})
  42. ;
  43. // relative path with quadratic beziers
  44. surface
  45. .createPath("m100 100 100 0 0 100q0 50-75-25t-25-75z")
  46. .setStroke({color: "blue"})
  47. .setFill("#ddd")
  48. .setTransform({dx: -50, dy: 150})
  49. ;
  50. // absolute path with quadratic bezier
  51. surface
  52. .createPath("M100 100 200 100 200 200Q200 250 125 175T100 100z")
  53. .setStroke({color: "blue"})
  54. .setFill("#ddd")
  55. .setTransform({dx: 100, dy: 150})
  56. ;
  57. // relative path with horizontal and vertical lines, and quadratic beziers
  58. surface
  59. .createPath("m100 100h100v100q0 50-75-25t-25-75z")
  60. .setStroke({color: "blue"})
  61. .setFill("#ddd")
  62. .setTransform({dx: 250, dy: 150})
  63. ;
  64. };
  65. dojo.addOnLoad(makeShapes);
  66. </script>
  67. </head>
  68. <body>
  69. <h1>dojox.gfx setPath and curve test</h1>
  70. <div id="test" style="width: 500px; height: 500px;"></div>
  71. <p>That's all Folks!</p>
  72. </body>
  73. </html>