开发者

How to get image from silverlight to non-silverlight?

I need a very weird thing I admit. I hope you'll be able to help me.

My current situation (all in one solution VS2010):

  • I have the Silverlight assem开发者_如何学Pythonbly with user-control (basically a drawing of kind)
  • I have a WCF service to provide the images (hosted in the website project)

I somehow need to:

  • when someone requests the RESTful service (above) for the image of a certain size
  • create, set-up and render that control to an image (I did it using the WriteableBitmap)
  • return the image to the service somehow <-- THIS IS MY PROBLEM
  • provide that image as a response (I know how to do that)

I've tried to reference the Silverlight assembly (from non-Silverlight assembly) with helper class returning the image. But that's just ugly.

  • Is there a way to host the WCF service that is inside Silverlight ?
  • If no, is there any other way to get the image from the Silverlight -> non-Silverlight service class

Thanks, Kate

Note: The Silverlight control is a massive one, and used in three other projects (editor, viewer, windows phone 7 application) so I can't really move it. Also Silverlight's WPF-like drawing is far superior to non-Silverlight.


There are lots of ways to do this, and I'm not entirely clear on what you're trying to accomplish, but something like this should work:

(1) The WriteableBitmap.Pixels property should contain an RGBA version of the image in question.

(2) Use FJCore to convert the RGBA bytes to JPEG format.

(3) Submit the JPEG file (contained in a byte[] array) via a call to the web service.

(4) On the web service, save the file in some appropriate location, where the other non-Silverlight applications can access it.

Would that do something like what you need?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜