Wednesday, April 11th, 2007
Prototype Graphic Framework
Sebastien Gruhier has created useful libraries such as the Prototype Window component.
Now, he has created the Prototype Graphic Framework (PGF) - a framework based on prototype to display vectorial shapes inside a web browser.
The framework has various renderers that sit on top of SVG, Canvas, and VML, so you can plug and play (although canvas support is limited right now).
-
-
// Create an SVG renderer
-
var renderer = new SVGRenderer("whiteboard");
-
-
// Create a rectangle with some attributes like color and bounds
-
var rect = new Graphic.Rectangle(renderer);
-
rect.setFill({r: 255, g: 0, b: 0, a: 128});
-
rect.setStroke({r: 255, g: 255, b: 0, a: 128, w: 5});
-
rect.setBounds(10, 20, 200, 300);
-
rect.setRoundCorner(10, 10);
-
rect.translate(10, 20);
-
rect.rotate(30);
-
-
renderer.add(rect);
-












Great job!
Very cool!
I will definitely include this in my future projects.
Great. I think this framework could be a milestone of web application’s developing
It is great! Thanks for your working.
Isn’t this done already several time?
dojo.gfx
http://www.dojotoolkit.org
cumulate draw:
http://www.cumulatelabs.com
Very cool! The SVG version works great, but the Canvas one is broken (as author says, it’s not his priority). I love the select demo. Mmm!
Very cool! The SVG version works great, but the Canvas one is broken (as author says, it’s not his priority). I love the select demo. Mmm!