tags:

views:

667

answers:

2

I am trying to port a WebForms app to Silverlight, this application is using the GDI Graphics class to draw polygons to a in-memory bitmap, it will then do pixel by pixel comparisons so I need access to the pixel buffer.

Example:

    Graphics g = Graphics.FromImage(bmp);
    g.FillClosedCurve(brush, points, FillMode.Winding);

I have done some serious googling trying to figure out how to draw polygons and then be able to access the pixel buffer of the canvas surface. My findings indicate that this is not possible with the WPF silverlight graphics, so I need to use a custom graphics library but have only found some 3D libraries. Is there a simple 2D library for silverlight or should I just go a head and write a polygon render algorithm myself?

+2  A: 

If you write a polygon rendering algorithm for Silverlight, it would have to be all managed code, I haven't seen any examples of this, but if you write one let me know, I've been looking for something like the for XNA.

Silverlight 3 should be adding some of the things you need to make this a lot easier like rendering to a texture and accessing a bitmap at the pixel level.

Bill Reiss
A: 

Could you grab an image from a server and process that? You could dynamically generate the image and you'd have access to whatever you needed outside of Silverlight.

Dan Goldstein
I need to do it all client side for performance reasons
Torkel