How can I write a WriteableBitmap from Silverlight to the file system, I'm not sure what to do with FileStream to make this work, it can be in the format of Bitmap, PNG, Jpeg, etc., if a commercial library is not required.
Can this be done?
Here is my SaveDialog call, below:
Dim SaveDialog As New SaveFileDialog
If SaveDialog.ShowDialog Then
Try
Using FileStream As Stream = SaveDialog.OpenFile
' Save Image File Code Here
End Using
Catch ex As Exception
End Try
End If
Edit
Added mention of WritableBitmap, since this is what my XAML writes, I just need to save the WriteableBitmap.Pixels property, which is a one-dimensional array of integer pixels, can this be put into the stream, and if so, how?
, , Pixel Stream
, , "" ,
, ,
, , ( - ).
JPEG PNG , , , , , PNGEncoding, , . BMP ?
Dim Image As Imaging.WriteableBitmap = _Style.Image
Dim Area As Integer = Image.PixelWidth * Image.PixelHeight
For Raster As Integer = 0 To Area - 1
Dim Pixel As Integer = Image.Pixels(Raster)
Dim Bytes() = BitConverter.GetBytes(Pixel And &HFF)
FileStream.Write(Bytes, 0, 4)
Next