[dojo-contributors] Re: Draft: Unified 2D graphics subsystem for Dojo

Eugene Lazutkin eugene at lazutkin.com
Wed Jun 7 01:25:43 EDT 2006

gavin at dfmm.org wrote:
> surface.beginPath({def: 'Square'});
> // a bunch of drawing commands that define a square
> var square = surface.endPath();
> assert(square == null); // If defining, does not create the node
> square = surface.createShape('Square');
> assert(square != null); // The shape that would have been returned by endpath


> I like the idea of using an SVG subset and using client-side XSLT to
> transform it to VML. That *ought* to get a picture into the browser faster
> than interpreting it with javascript. We could then lazily instantiate
> javascript objects from the generated DOM nodes as required for
> interactivity.


> It may really be the Wrong Thing, but I'd like to do some benchmarking and
> prototypes to check -- I think there's a use for both Canvas-rendered
> graphics as well as DOM-oriented graphics. That's why I investigated the
> DirectAnimation api recently. It may be best to render some things one way
> and some another. Worth a try, at least.

Wow! Blast from the past! It's 1998 and IE4 finally bested Netscape's 
browser. :-) In the same vein: there are some filters available in IE, 
which can do gradients, matrix-defined transformations, and so on. But 
we may be too late to join the party --- it looks like DirectAnimation 
is not in Windows Vista: 

> As far as transformations go, that was the latest thing I was working on
> for the drawing editor. I was finding it mandatory to perform them myself
> even for simple rotations -- I needed to do the matrix calculation both to
> be able to specify the center of rotation and to calculate the positions
> of the "handle" objects once the object they affect was rotated.

Any serious graphics requires transformation matrices --- there is no 
way out of it, which puzzled me a lot, when I didn't find them in Canvas 
-- what were they thinking?

> For v1 of the library, what's the order of use cases?
> 1) Generic, canvas-compatible drawing surface for charting and widgets
> 2) DOM-style drawing objects for editable shapes
> 3) Animation for cartoons and presentational effects
> 4) Text effects? (VML and SVG both support text effects that HTML DIV
> elements cannot).

I am interested in #2. I am not so keen on editing --- IMHO it's a niche 
application, but having shapes as objects would facilitate almost any 
kind of interactive graphics (including editing). #1 --- I can go both 
ways. IMHO "charting and widgets" can be done with #2 effortlessly. #3 
--- should be synced up with the existing Dojo animation.



More information about the dojo-contributors mailing list