我想使用像素字節在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