Bliting two WriteableBitmap with WriteableBitmapEx

Apr 18, 2013 at 9:08 AM
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
Coordinator
Apr 18, 2013 at 9:48 AM
What the error message says.
  • Rene
Apr 18, 2013 at 2:22 PM
Thank you Rene.

One more question.
Now I understand the problem. However, if I want to the output writeablebitmap as a Bgr32 one. Is there any way to convert _imageFrame to blit?
Adam
Coordinator
Apr 18, 2013 at 3:10 PM
All WriteableBitmapEx algorithms rely on the Pbgra32 format, so all your bitmaps have to use that format.