0

I tried to blit two writeablebitmap. However, the debugger prompted a error message stating the followings:

The input WriteableBitmap needs to have the Pbgra32 pixel format. Use the BitmapFactory.ConvertToPbgra32Format method to automatically convert any input BitmapSource ?to the right format accepted by this class.

Here is my code.

Rect cRect =new (320,240);
WriteableBitmap _bitmap = new WriteableBitmap(320, 240, 96, 96, PixelFormats.Bgr32, null);
_bitmap.WritePixels(new Int32Rect(0, 0, 320, 240), _image, 320*240, 0);    //_image is a image stream                  
_bitmap.Blit(cRect, _imageFrame, cRect); //_imageFrame is another writeablebitmap

Actually _imageFrame is a WriteableBitmap from a canvas which will change its content at regular time. Is there a more effective way to blit a writeablebitmap and a canvas?

Adam Aiken
  • 418
  • 7
  • 18

1 Answers1

0

Can you change to this line:

WriteableBitmap _bitmap = new WriteableBitmap(320, 240, 96, 96, PixelFormats.Pbgra32, null);

and something similiar on the _imageFrame WriteableBitmap

jordanhill123
  • 4,142
  • 2
  • 31
  • 40
  • Actually _imageFrame is a WriteableBitmap from a canvas which will change its content at regular time. Is there a more effective way to blit a writeablebitmap and a canvas? – Adam Aiken Apr 18 '13 at 09:28
  • I saw your previous question around this issue and you shouldn't have to change `imageFrame` if your using the excerpt from your other question. – jordanhill123 Apr 18 '13 at 09:33
  • Can I convert the Pbgra32 image to Bgr32 image? – Adam Aiken Apr 18 '13 at 14:11