The WriteableBitmapEx library project description:
The WriteableBitmapEx library is a collection of extension methods for Silverlight's WriteableBitmap. The WriteableBitmap class that was added in Silverlight 3, allows the direct manipulation of a bitmap and could be used to generate fast procedural images by drawing directly to a bitmap. The WriteableBitmap API is very minimalistic and there's only the raw Pixels array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods. The library extends the WriteableBitmap class with elementary and fast (2D drawing) functionality, supporting common shapes like point, line, ellipse, polyline, quad, rectangle, triangle. Conversion methods and functions to combine WriteableBitmaps (Blitting) are part of it too.Roots
The WriteableBitmapEx library has its origin in several blog posts:
- WriteableBitmap Extension Methods introduced the SetPixel methods.
- Drawing Lines - Silverlight WriteableBitmap Extensions II provided the DrawLine methods.
- Drawing Shapes - Silverlight WriteableBitmap Extensions III brought the shape functionality (ellipse, polyline, quad, rectangle, triangle).
- In Convert, Encode And Decode Silverlight WriteableBitmap Data I published the byte array conversion methods.
- Not at least Silverlight MVP Bill Reiss was faster than me on the Blit functions and introduced these in Blitting and Blending with Silverlight’s WriteableBitmap. He was so nice and allowed me to use his code in the WriteableBitmapEx library.
- Nikola Mihaylov (Nokola) made some optimizations on the DrawLine and DrawRectangle methods and posted them on his own blog or in the comments of my posts. So a release as open source project was really long overdue.
I recreated the whole Visual Studio 2008 solutions, changed the namespaces, headers, added comments and cleaned up the code base and samples. I also grouped the extension methods into different CS files with a partial class. It is now possible to include just a few methods by using the specific source CS files directly or all extension methods through the built library assembly.
License
The WriteableBitmapEx library is released as open source under the Microsoft Public License (Ms-PL) license. The Ms-PL license allows the use of the library without affecting the license of the user, thus making it also easily usable for commercial projects. On the other hand the weak copyleft characteristic ensures that changes on the source have to be committed back and that the library or parts of it always be free and never become closed source.
Touch it,
The WriteableBitmapEx CodePlex project site lives here. You might also want to see the Issue Tracker for a list of features that will be added in the future or to add your own. If you have any comments, questions, suggestions or want to see your name in the Credits list, don't hesitate and write a comment, use the Issue Tracker on the CodePlex site or contact me via any other media.
Have fun and let me know it if you do some cool stuff with it.
Thank you very much for your time and effort into making this available to us.
ReplyDeleteI'm using an older version of your code in my codeplex project to show off Audio visualisation and I'll soon be updating to use your CodePlex version.
thanx again.
oh, YES!!! Thanks for publishing it there...very nice! :) That's the beginning of a nice framework WriteableBitmaps :)
ReplyDeleteThanks I really appreciate it!
ReplyDelete@Ahura
Your library is cool. I had a Silverlight FFT control on my ideas list. I just removed it. :) Keep up the good stuff.
@Nokola
I'll do my best. Again, thanks for your contribution!
does not work in WPF =(
ReplyDeleteHi Glum,
ReplyDeletethe WriteableBitmapEx library is targeted for Silverlight, not WPF. But it should not be hard to recompile it for WPF.
In my work I need to make screenshot from my silverlight app. I can do it with WriteableBitmap class but... This class doesn't work when I try to make screenshot from StackPanel and some another panels.
ReplyDeleteCan I do it with WriteableBitmapEx class?
The WriteableBitmapEx library is a collection of extension methods for the WriteableBitmap class. It's not a new class.
ReplyDeleteA screenshot of a StackPanel should work. Try this:
var wb = new WriteableBitmap(myStackPanel, null);
If not, you can put the StackPanel in another Grid and make a screenshot of this.