I'm trying to cross compile some libraries for WPF and Silverlight. Currently one of the libraries depends on System.Drawing.Bitmap which is not available in Silverlight.
It's a class that represents a device specific image format, and holds a reference to a Bitmap instance in order to display this image in a WPF application.
What could I use instead of the Bitmap class in order to hold a reference to an Image which I can display in both silverlight and wpf ? (cannot be file based, must be in memory).
System.Windows.Media.Imaging for WPF and Silverlight. This one shows how to work with it in memory: Silverlight 4.0: How to convert byte[] to image?
The closest you will get is the WriteableBitmap
class but these classes a quite different between frameworks. If you are looking to create a common library to use in both your WPF and Silverlight applications you will probably need to create an abstract that your applications code to and then write two different implementations of the abstract.
If both chunks of code return something tha,t at least lexically, is a "WriteableBitmap" then you might be able to integrate that into common code.
Worth looking at for the Silverlight side of the implementation would be WriteableBitmapEx.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With