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

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

Added Dojo 1.9.3 release.

File size: 3.0 KB
Line 
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<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
11<script type="text/javascript">
12dojo.require("dojox.gfx");
13
14createSurface = function(){
15        var surface = dojox.gfx.createSurface("test", 500, 400);
16        surface.whenLoaded(makeShapes);
17};
18
19makeShapes = function(surface){
20        // relative path with cubic beziers
21        surface
22                .createPath("m100 100 100 0 0 100c0 50-50 50-100 0s-50-100 0-100z")
23                .setStroke({color: "black", style:'longdash', width:3})
24                .setFill("red")
25                .setTransform({dx: -50, dy: -50})
26                ;
27        // absolute path with cubic bezier
28        surface
29                .createPath("M100 100 200 100 200 200C200 250 150 250 100 200S50 100 100 100z")
30        .setStroke({color: "black", style:'longdash', width:3})
31                .setFill("#f80")
32                .setTransform({dx: 100, dy: -50})
33                ;
34        // relative path with horizontal and vertical lines, and cubic beziers
35        surface
36                .createPath("m100 100h100v100c0 50-50 50-100 0s-50-100 0-100z")
37        .setStroke({color: "black", style:'longdash', width:3})
38                .setFill("yellow")
39                .setTransform({dx: 250, dy: -50})
40                ;
41        // relative path with quadratic beziers
42        surface
43                .createPath("m100 100 100 0 0 100q0 50-75-25t-25-75z")
44        .setStroke({color: "black", style:'longdash', width:3})
45                .setFill("green")
46                .setTransform({dx: -50, dy: 150})
47                ;
48        // absolute path with quadratic bezier
49        surface
50                .createPath("M100 100 200 100 200 200Q200 250 125 175T100 100z")
51        .setStroke({color: "black", style:'longdash', width:3})
52                .setFill("blue")
53                .setTransform({dx: 100, dy: 150})
54                ;
55        // relative path with horizontal and vertical lines, and quadratic beziers
56        surface
57                .createPath("m100 100h100v100q0 50-75-25t-25-75z")
58        .setStroke({color: "black", style:'longdash', width:3})
59                .setFill("#f0f")
60                .setTransform({dx: 250, dy: 150})
61                ;
62};
63
64dojo.addOnLoad(createSurface);
65
66</script>
67</head>
68<body>
69<h1>dojox.gfx setPath and curve test</h1>
70<div id="test" style="width: 500px; height: 400px;"></div>
71<p>Legend:</p>
72<ul>
73        <li style="background: red"><span style="color: white">relative path with cubic beziers</span></li>
74        <li style="background: #f80"><span style="color: black">absolute path with cubic bezier</span></li>
75        <li style="background: yellow"><span style="color: black">relative path with horizontal and vertical lines, and cubic beziers</span></li>
76        <li style="background: green"><span style="color: white">relative path with quadratic beziers</span></li>
77        <li style="background: blue"><span style="color: white">absolute path with quadratic bezier</span></li>
78        <li style="background: #f0f"><span style="color: black">relative path with horizontal and vertical lines, and quadratic beziers</span></li>
79</ul>
80<p>That's all Folks!</p>
81</body>
82</html>
Note: See TracBrowser for help on using the repository browser.