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

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

Added Dojo 1.9.3 release.

File size: 2.0 KB
Line 
1<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2<head>
3<title>Dojo Unified 2D Graphics</title>
4<style type="text/css">
5        @import "../../../../dojo/resources/dojo.css";
6        @import "../../../../dijit/tests/css/dijitTests.css";
7</style>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9<!-- SVGWEB { -->
10<meta name="svg.render.forceflash" content="true"/>
11<script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
12<script src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
13<!-- } -->
14<script type="text/javascript">
15dojo.require("dojox.gfx");
16dojo.require("dojo.colors"); // pull in CSS3 color names
17
18makeShapes = function(){
19        var SIDE = 10;
20        var fillObj = {
21                colors: [
22                        { offset: 0,   color: [255, 255, 0, 0] },
23                        { offset: 0.5, color: "orange" },
24                        { offset: 1,   color: [255, 255, 0, 0] }
25                ]
26        };
27        var surface = dojox.gfx.createSurface(dojo.byId("grad"), 300, 300);
28        /* SVGWEB { */
29        surface.whenLoaded(function() {
30        var start = new Date().getTime();
31        var suspendId = surface.rawNode.suspendRedraw(10000);
32       
33        // create a background
34        for(var i = 0; i < 300; i += SIDE){
35                for(var j = 0; j < 300; j += SIDE){
36                        surface.
37                                createRect({x: j, y: i, width: 10, height: 10}).
38                                setFill((Math.floor(i / SIDE) + Math.floor(j / SIDE)) % 2 ? "lightgrey" : "white");
39                }
40        }
41        // create a rect
42        surface.createRect({
43                width:  300,
44                height: 100
45        }).setFill(dojo.mixin({
46                type: "linear",
47                x1: 0, y1: 0,
48                x2: 300, y2: 0
49        }, fillObj));
50        // create a circle
51        surface.createEllipse({
52                cx: 150,
53                cy: 200,
54                rx: 100,
55                ry: 100
56        }).setFill(dojo.mixin({
57                type: "radial",
58                cx: 150,
59                cy: 200
60        }, fillObj));
61       
62        surface.rawNode.unsuspendRedraw(suspendId);
63        //alert(new Date().getTime() - start);
64        });
65        /* } */
66};
67dojo.addOnLoad(makeShapes);
68</script>
69<style type="text/css">
70#grad { width: 300px; height: 300px; }
71</style>
72</head>
73<body>
74<h1>dojox.gfx Alpha gradient test</h1>
75<div id="grad"></div>
76</body>
77</html>
Note: See TracBrowser for help on using the repository browser.