drawing text and saving as image

181 views
Skip to first unread message

selva

unread,
Jul 23, 2009, 2:39:11 PM7/23/09
to google-excanvas
Hi,

I need to draw text on canvas and save the modified canvas as a image
to a local file.

If i use textcanvas, will it retain the test drawn on the canvas to
the final image.My undestanding is "it is based on <div> container,so
it may look as if embedded into canvas but exists as a separate
layer,hence text will not be available after saving as a image".Am i
right?,if not please help me out.








Thanks
Selvam

Emil A Eklund

unread,
Jul 23, 2009, 2:50:30 PM7/23/09
to google-...@googlegroups.com

Hi,

Sadly ExCanvas does not support saving to an image at all.

There are a few earlier threads in the group about it giving a bit more
detail as to why and listing possible workarounds. The short answere
though is that saving to an image is not supported and it's unlikely
that we'll be able to add support for it in the near future.

--
Emil A Eklund
em...@eae.net

signature.asc

S.Selvam

unread,
Jul 23, 2009, 4:05:50 PM7/23/09
to google-...@googlegroups.com
Thank you for your quick response.I will dig it further.In general(normal canvas),is it possible to place <div> containing text in a canvas and save it.Kindly execuse, if it is wrong place to ask this.

--
Yours,
S.Selvam

Ryan Schmidt

unread,
Jul 23, 2009, 4:54:09 PM7/23/09
to google-...@googlegroups.com
On Jul 23, 2009, at 15:05, S.Selvam wrote:

> In general(normal canvas),is it possible to place <div> containing
> text in a canvas and save it.

That would not be possible, but browsers are beginning to support
text on the canvas natively, which should be no different from
anything else on the canvas and so you should be able to save it to
an image. Here's one place where the functions are documented:

https://developer.mozilla.org/en/Drawing_text_using_a_canvas

Fabien Ménager

unread,
Jul 23, 2009, 4:58:48 PM7/23/09
to google-excanvas
Yes, the browsers are seriously beginning to support it, but there are
still missing ones (Opera, Firefox 3.0-, Safari 3).
I made a lib that could help you if you want to use these functions in
these browsers : http://code.google.com/p/canvas-text/
It is really young, so do not hesitate to post a bug report or a
suggestion on the issue tracker of the project !

Fabien

S.Selvam

unread,
Jul 23, 2009, 9:58:51 PM7/23/09
to google-...@googlegroups.com
 
Thanks,

    Yes,I found a few methods, but cross platform seems to be as issue.Also, i need to use floating text over the canvas.Once user save the canvas,the text needs to be drawn on the canvas.(Basically i want to let the user to move the text over canvas image,but API functions embedes at once).

So i guess my solution could be,"Text needs to be placed inside <div>  and let the user drag the text over canvas,once saved ,draw the text on the canvas using suitable API functions based on <div> position".

I would like to know ,if i was right and any suggestions.
 








--
Yours,
S.Selvam

Fabien Ménager

unread,
Jul 24, 2009, 2:30:02 AM7/24/09
to google-excanvas
I really think you should draw the test on the canvas, from the start.
First because the result may be different from the render with the
<div> and that the user could save the canvas as image with right
click > "Save image as" in Firefox for example.
You can animate the text on a canvas, make it follow the mouse, you
can do anything, but to do it easily, you should use a JS framework to
make your life easier and be able to handle the events in a cross-
browser way. Personnally, I use PrototypeJS, but I think the community
tends to use jQuery.
Here are a few examples of what we can do with text on a canvas :
http://canvas-text.googlecode.com/svn/trunk/examples/index.html
You cannot do all of that with a div.

But I don't think the Explorer-canvas Google group is the place to
discus about that, I think you should post your Question on
Stackoverflow.com, and you'll get the best answer there.

Fabien

On Jul 24, 3:58 am, "S.Selvam" <s.selvams...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages