| 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 |
|
| 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"> |
| 15 |
dojo.require("dojox.gfx"); |
| 16 |
dojo.require("dojo.colors"); |
| 17 |
|
| 18 |
makeShapes = function(){ |
| 19 |
var lg1 = { |
| 20 |
type: "linear", |
| 21 |
x1: 0, y1: 0, |
| 22 |
x2: 300, y2: 0, |
| 23 |
colors: [ |
| 24 |
{ offset: 0, color: [0, 0, 0, 0] }, |
| 25 |
{ offset: 0.1, color: "#000000" }, |
| 26 |
{ offset: 0.2, color: "red" }, |
| 27 |
{ offset: 0.3, color: "rgb(0,255,0)" }, |
| 28 |
{ offset: 0.4, color: "blue" }, |
| 29 |
{ offset: 0.5, color: "#ff0" }, |
| 30 |
{ offset: 0.6, color: [128] }, |
| 31 |
{ offset: 0.7, color: [128, 128, 64] }, |
| 32 |
{ offset: 1, color: [0, 255, 0, 0] } |
| 33 |
] |
| 34 |
}; |
| 35 |
var lg2 = { |
| 36 |
type: "linear", |
| 37 |
x1: 0, y1: 0, |
| 38 |
x2: 300, y2: 0, |
| 39 |
colors: [ |
| 40 |
{ offset: 0.2, color: "red" }, |
| 41 |
{ offset: 0.3, color: "yellow" } |
| 42 |
] |
| 43 |
}; |
| 44 |
var surface = dojox.gfx.createSurface(dojo.byId("grad"), 300, 300); |
| 45 |
/* SVGWEB { */ |
| 46 |
surface.whenLoaded(function() { |
| 47 |
var group = surface.createGroup(); |
| 48 |
var rect1 = surface.createRect({ |
| 49 |
width: 300, |
| 50 |
height: 100 |
| 51 |
}); |
| 52 |
rect1.setFill(lg1); |
| 53 |
var rect2 = surface.createRect({ |
| 54 |
y: 150, |
| 55 |
width: 300, |
| 56 |
height: 100 |
| 57 |
}); |
| 58 |
rect2.setFill(lg2); |
| 59 |
group.add(rect1); |
| 60 |
group.add(rect2); |
| 61 |
}); |
| 62 |
/* } */ |
| 63 |
}; |
| 64 |
dojo.addOnLoad(makeShapes); |
| 65 |
</script> |
| 66 |
<style> |
| 67 |
v:group { text-align: left; } |
| 68 |
#grad { width: 300px; height: 300px; } |
| 69 |
</style> |
| 70 |
</head> |
| 71 |
<body> |
| 72 |
<h1>dojox.gfx Linear Gradient test</h1> |
| 73 |
<div id="grad"></div> |
| 74 |
</body> |
| 75 |
</html> |