[Dojo-interest] Drawing API question

gavin at dfmm.org gavin at dfmm.org
Wed Apr 26 22:44:56 MDT 2006


So, I'm designing the drawing APIs and realized that one could very well
want to draw with both SVG and Canvas, or VML and DirectAnimation, or
Walter Zorn graphics and RPC calls to GD on the server, at the same time,
in the same drawing.

So, in cases where you can draw the same thing with different
technologies, how would you like it to look?

var dwg = new dojo.draw.Drawing("someNodeName");
var rect = new dojo.draw.Rectangle(dojo.draw.CANVAS);
var rect2 = new dojo.draw.Rectangle(dojo.draw.VECTOR);
dwg.addShape(rect);
dwg.addShape(rect2);

or would the drawings be the arbiter of graphics contexts, thus:

var dwg = new dojo.draw.Drawing("somedivsomeplace", dojo.draw.CANVAS);
var rect = new dojo.draw.Rectangle();
dwg.addShape(rect);

rect and rect2 would have identical APIs, but in one case would manage a
bitmap and in another a vector drawing node.

Originally I was thinking I'd bootstrap just a single driver for a given
page load, but now I'm not so sure -- I can certainly think of times when
you'd want to mix canvas and SVG elements in the same conceptual "drawing"
frame.

Gavin


More information about the Dojo-interest mailing list