Debian Codegraph @

dojox/gfx/tests/svgweb/test_setPath.html

raw symbols SCIP
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 li {font-weight: bold;}
9 </style>
10 <!-- SVGWEB { -->
11 <meta name="svg.render.forceflash" content="true"/>
12 <script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
13 <script src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
14 <!-- } -->
15 <script type="text/javascript">
16 dojo.require("dojox.gfx");
17
18 makeShapes = function(){
19 var surface = dojox.gfx.createSurface("test", 500, 400);
20 // relative path with cubic beziers
21 /* SVGWEB { */
22 surface.whenLoaded(function() {
23 surface
24 .createPath("m100 100 100 0 0 100c0 50-50 50-100 0s-50-100 0-100z")
25 .setStroke({color: "black"})
26 .setFill("red")
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: "black"})
33 .setFill("#f80")
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: "black"})
40 .setFill("yellow")
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: "black"})
47 .setFill("green")
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: "black"})
54 .setFill("blue")
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: "black"})
61 .setFill("#f0f")
62 .setTransform({dx: 250, dy: 150})
63 ;
64 });
65 /* } */
66 };
67
68 dojo.addOnLoad(makeShapes);
69
70 </script>
71 </head>
72 <body>
73 <h1>dojox.gfx setPath and curve test</h1>
74 <div id="test" style="width: 500px; height: 400px;"></div>
75 <p>Legend:</p>
76 <ul>
77 <li style="background: red"><span style="color: white">relative path with cubic beziers</span></li>
78 <li style="background: #f80"><span style="color: black">absolute path with cubic bezier</span></li>
79 <li style="background: yellow"><span style="color: black">relative path with horizontal and vertical lines, and cubic beziers</span></li>
80 <li style="background: green"><span style="color: white">relative path with quadratic beziers</span></li>
81 <li style="background: blue"><span style="color: white">absolute path with quadratic bezier</span></li>
82 <li style="background: #f0f"><span style="color: black">relative path with horizontal and vertical lines, and quadratic beziers</span></li>
83 </ul>
84 <p>That's all Folks!</p>
85 </body>
86 </html>