Canvas Tag + Rails Ajax


#1

Hi all,

Just looking for a quick sanity check. I was thinking of writing a
plugin for rails to give rails developers a good way of using the new
firefox 1.5/safari canvas tags. I was thinking of grabbing an
existing ruby graphics library and modifying it so that it renders
via the canvas tag…

So you could have link_to_remote pointing to controller actions that
instead of returning html would return “something” that results in
canvas drawing.

Does this sound at all reasonable? Any specific libraries anyone
could suggest that might be a good point to start from?


#2

I should mention it was trivial to get ajax calls to the controller
which returns javascript to draw to the canvas working…

The harder part will be to have a “javascript renderer” for an
existing gui/graphic library.


#3

On 27-nov-2005, at 18:52, Luke Galea wrote:

I should mention it was trivial to get ajax calls to the controller
which returns javascript to draw to the canvas working…

The harder part will be to have a “javascript renderer” for an
existing gui/graphic library.

I don’t quite get why you would need something like that. As I know
you can just load a PNG into the canvas, and pick this PNG from there
after it has been edited. Drawing with canvas is more of a raster-
based state machine so I guess it makes much more sence to store
versioned raster images instead of drawing commands for the canvas. A
use I recently envisioned for my app would be to just allow people
“scribble” on a picture and then save the created PNG back to server.

I think you could probably use difference matting to let your
“scribbled” versions compress better (i.e. equalize all the pixels
which didn’t change after scribbling).


#4

if you need an impressive demo of what canvas is capable to do, check
out
this, it got slashdotted today:

http://www.abrahamjoffe.com.au/ben/canvascape/

have fun