我试图对两个 writeablebitmap 进行 blit。但是,调试器提示了一条错误消息,说明如下:
输入 WriteableBitmap 需要具有 Pbgra32 像素格式。使用 BitmapFactory.ConvertToPbgra32Format 方法自动将任何输入 BitmapSource 转换为此类接受的正确格式。
这是我的代码。
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
实际上 _imageFrame 是来自画布的 WriteableBitmap,它会定期更改其内容。有没有更有效的方法来 blit 可写位图和画布?