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

gavin at dfmm.org gavin at dfmm.org
Wed Jun 7 02:47:53 EDT 2006

> Quick shot thoughts here:
> 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.
> I'm thinking  (and hoping) that parts of this translation will be
> Dojo-specific, in that attach points will be preserved.  If I do it right
> (started working on it), the translation would happen *before* the Dojo
> parser has at it--and we might even consider letting it be a separate
> build
> kind of thing, so that you could have VML spit out at design time for
> manipulation.  Certainly that would be a hell of a lot more efficient.

So the file served up would be pre-translated into the target vector format?

<v:rect dojo-hint-foo="hint" dojo-hint-bar="baz"/>
<svg:rect dojo-hint-foo="hint" dojo-hint-bar="baz"/>

This would be fine for widget templates, though it makes them a bit more
difficult to author. Wouldn't help too much for user-edited drawings
unless there's back-end transformation.

> 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.
> I think that we should pursue both paths as well; there's nothing wrong
> with
> having both a procedural and a declarative API, as long as they cooperate.
> Of course, my end goal is that vector definitions are done in SVG only,
> and
> Dojo handles the cross platform issues.
> Just so we're clear, I'm proposing 2 things:
> 1. the SVG to VML translation

I've seen some attempts at this on the net, though the one I tried failed
pretty badly. Here's an academic paper which might also help:


> Animation for SVG (as implemented in FF) is poor right now--if you're
> thinking that it will support SMIL-type structures.  However, animation
> techniques that are used in Dojo for HTML work just fine right now as it
> is,
> so I'd advocate not really worrying about that use case as of yet.

I was expecting we'd use the dojo animation system for v1; I'd rather not
bother with declarative animation until it's "free" in at least one
browser. Though I suppose it's in the IE deprecated obscure have to read a
typelib for documentation DirectAnimation system someplace.

> Text manipulation...that's another story.  My instinct is to say we use
> mixed documents for that always (i.e. embed an HTML element inside an SVG
> one for text handling, etc)...I'll have better info soon enough as to
> what's
> possible in terms of transformations in VML.

The v:textpath element looks like it can be transformed arbitrarily as
well as locking text to a path word-art style. I think for dojo 0.4-0.5 we
can just support rotations and some interoperability with HTML.

More information about the dojo-contributors mailing list