views:

273

answers:

2

I have just started using silverlight 2 beta and cannot find how to or if it is possible to render a canvas to an bitmap image and then upload it to my web server?

Is this possible and if so how would I complete this task?


Update: This is now possible under silverlight 3 using a writable bitmap to save the XAML as a JPEG see the blog post here: http://blog.blueboxes.co.uk/2009/07/21/rendering-xaml-to-a-jpeg-using-silverlight-3/

+3  A: 

You can't render a canvas to a bitmap in Silverlight 2, but if you could generate a XAML version of your Canvas, you could pass it to the server and do something like this server side:

http://www.thedatafarm.com/blog/2008/01/31/ConvertingSilverlightInkPresenterImagesToAPNGFile.aspx

Bill Reiss
This is now possible with silverlight 3 see the above update
John
A: 

The only option you have now (if you want it done in the Silverlight CLR on the client side) is to start with fjcore

http://code.google.com/p/fjcore/

It's only a starting point, you will have to write a lot of code -- it mainly will give you an Image representation and a JPEG Encoder.

You can't get the pixels of the canvas, so if you need that, then I think you are out of luck. But fjcore would give you an Image object that you could write drawing routines for and then you would have to draw on that instead (not sure what you are trying to do, but if it's simple, it might be ok).

Lou Franco