0

I am having a problem converting the following code snippet for an existing component into Silverlight.

Bitmap bmp = new Bitmap(width, height);
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
Marshal.Copy(data, 0, bmpData.Scan0, data.Length);
bmp.UnlockBits(bmpData);

data is byte[] and width and height are the required image width and height.

Can anyone share some ideas on this?

Nikolaos Dimopoulos
  • 11,495
  • 6
  • 39
  • 67

1 Answers1

0
using (MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
{
    BitmapImage im = new BitmapImage();
    im.SetSource(ms);
    this.imageControl.Source = im;
}
Kjuly
  • 34,476
  • 22
  • 104
  • 118
Dzmitry Martavoi
  • 6,867
  • 6
  • 38
  • 59