我想使用像素字节在windows phone 8中绘制图像。所以我通过C++库(C++/CLI)获得一些像素字节。但像素数据不包含位图标题。它只是像素字节数组。 这是可能将像素数据数组转换为位图在windows phone中没有位图标题的图像?如何将像素字节数组转换为Windows Phone 8中的位图图像
public void updateImage(byte[] byteArray, UInt32 bufferSize, int cvtWidth, int cvtHeight)
{
// I saw this source a lot of search. But It's not work. It makes some exeption.
BitmapImage bi = new BitmapImage();
MemoryStream memoryStream = new MemoryStream(byteArray);
bi.SetSource(memoryStream);
ImageScreen.Source = bi;
}
如何使用WriteableBitmap?我尝试。但我无法画画。这是我的代码。 'MemoryStream memoryStream = new MemoryStream(); WriteableBitmap wb = new WriteableBitmap(cvtWidth,cvtHeight); wb.SetSource(byteArray.AsBuffer()。AsStream()); //发生异常 ImageScreen.Source = wb;' – Proglamour
以示例 – Gusman
更新答案感谢您的回复。但在Windows Phone 8中没有PixelBuffer。我认为它在Windows 8中工作。 – Proglamour