2150 |
mathias |
1 |
-------------------------------------------------------------------------------
|
|
|
2 |
dojox.gfx
|
|
|
3 |
-------------------------------------------------------------------------------
|
|
|
4 |
Version 1.100
|
|
|
5 |
Release date: 08/01/2006
|
|
|
6 |
-------------------------------------------------------------------------------
|
|
|
7 |
Project state:
|
|
|
8 |
beta
|
|
|
9 |
HTMLCanvas renderer: experimental
|
|
|
10 |
-------------------------------------------------------------------------------
|
|
|
11 |
Credits
|
|
|
12 |
Eugene Lazutkin (eugene.lazutkin@gmail.com)
|
|
|
13 |
Kun Xi (bookstack@gmail.com)
|
|
|
14 |
Chris Mitchell (ccmitchellusa@gmail.com) HTML Canvas
|
|
|
15 |
-------------------------------------------------------------------------------
|
|
|
16 |
Project description
|
|
|
17 |
|
|
|
18 |
Implementation of simple portable 2D graphics library.
|
|
|
19 |
-------------------------------------------------------------------------------
|
|
|
20 |
Dependencies:
|
|
|
21 |
|
|
|
22 |
Dojo Core
|
|
|
23 |
-------------------------------------------------------------------------------
|
|
|
24 |
Documentation
|
|
|
25 |
|
|
|
26 |
Currently it can be found here: http://docs.google.com/Doc?id=d764479_1hnb2tn
|
|
|
27 |
|
|
|
28 |
HTMLCanvas Renderer Status
|
|
|
29 |
|
|
|
30 |
To use canvas rendering, insert 'canvas' at the beginning of the gfxRenderers list in your
|
|
|
31 |
djConfig, for example:
|
|
|
32 |
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
|
33 |
djConfig="parseOnLoad: true, gfxRenderer: 'canvas,svg,silverlight,vml'"></script>
|
|
|
34 |
canvas currently will only render on non-IE browsers (see dojox/gfx.js for where the renderer is loaded);
|
|
|
35 |
although it should be possible to use an IE canvas implementation (like Google's); however, it will be very slow.
|
|
|
36 |
|
|
|
37 |
The following tests can be made to work with HTML Canvas with minor testcase modification:
|
|
|
38 |
dojox/gfx/tests
|
|
|
39 |
test_gfx.html-Bugs #1
|
|
|
40 |
test_arc.html
|
|
|
41 |
test_bezier.html
|
|
|
42 |
test_pattern.html
|
|
|
43 |
test_gradient.html
|
|
|
44 |
test_linearGradient.html
|
|
|
45 |
test_image1.html - Limitation #3
|
|
|
46 |
test_transform.html - Bug #1
|
|
|
47 |
test_poly.html - Bug #1
|
|
|
48 |
dojox/gfx/demos
|
|
|
49 |
butterfly.html - Bug #1
|
|
|
50 |
lion.html - Bug #1
|
|
|
51 |
tiger.html - Bug #1
|
|
|
52 |
circles.html - No event processing yet :(
|
|
|
53 |
creator.html
|
|
|
54 |
dojox/chart
|
|
|
55 |
test_pie2d.html - Dojo Charts on iPhone anyone? :)
|
|
|
56 |
test_chart2d.html -
|
|
|
57 |
|
|
|
58 |
// To make charts work, the following line needs to be added to the end of the
|
|
|
59 |
// Chart2D.js render() method (prior to return)
|
|
|
60 |
if(this.surface.render){this.surface.render()};
|
|
|
61 |
|
|
|
62 |
Known Limitations:
|
|
|
63 |
1) event handling- plan is to capture all events at canvas, perform intersect/hit
|
|
|
64 |
tests (not implemented) against scene graph, then propogate event to top-most
|
|
|
65 |
intersected shape. HtmlCanvas shape need intersectsStroke and intersectsBounds,
|
|
|
66 |
and intersects (region).
|
|
|
67 |
2) SVG and VML are "live" scene graphs; eg. any state change to objects in the
|
|
|
68 |
scene automatically get rendered in next engine render pass. For canvas, it's
|
|
|
69 |
procedural, and current implementation requires application to call surface.render()
|
|
|
70 |
whenever scene needs to be updated. Plan is to do dirty region checking based
|
|
|
71 |
on bounding boxes (currently not properly computed), and track dirty areas anytime
|
|
|
72 |
state changes (invalidate) separate from render phase.
|
|
|
73 |
Add the following call where changes to the scene graph are complete and you want to
|
|
|
74 |
render:
|
|
|
75 |
|
|
|
76 |
if (surface.render){surface.render();}
|
|
|
77 |
|
|
|
78 |
4) Text/Text Paths - Text shape is implemented using DIV overlays. Many text styles are not
|
|
|
79 |
applied, and outline/fills are not possible. This is due to limitations in Canvas spec.
|
|
|
80 |
Firefox 3.0 has proprietary text functions that we could test for and use once FF3 is out.
|
|
|
81 |
No luck on Safari.
|
|
|
82 |
3) No Image skewing - Limitation of Canvas
|
|
|
83 |
|
|
|
84 |
Known Bugs:
|
|
|
85 |
1) Matrix xformations (applied from root to shape leaf nodes) not quite right--but very close.
|
|
|
86 |
Canvas does not have a built in transformation function that allows skewing. Need to
|
|
|
87 |
track skew matrix with Shape, and perform other trans/rot/scale transformations without
|
|
|
88 |
using canvas transform functions.
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
-------------------------------------------------------------------------------
|
|
|
92 |
Installation instructions
|
|
|
93 |
|
|
|
94 |
Grab the following from the Dojo SVN Repository:
|
|
|
95 |
http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/gfx.js
|
|
|
96 |
http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/gfx/*
|
|
|
97 |
|
|
|
98 |
Install into the following directory structure:
|
|
|
99 |
/dojox/gfx/
|
|
|
100 |
|
|
|
101 |
...which should be at the same level as your Dojo checkout.
|
|
|
102 |
-------------------------------------------------------------------------------
|