メトロアプリのピクセルのバイト配列からビットマップを作成したい。以下の関数は同じために使用されました:
//Here create the Bitmap to the know height, width and format
Bitmap bmp = new Bitmap( 352, 288, PixelFormat.Format24bppRgb);
//Create a BitmapData and Lock all pixels to be written
BitmapData bmpData = bmp.LockBits(
new Rectangle(0, 0, bmp.Width, bmp.Height),
ImageLockMode.WriteOnly, bmp.PixelFormat);
//Copy the data from the byte array into BitmapData.Scan0
Marshal.Copy(data, 0, bmpData.Scan0, data.Length);
//Unlock the pixels
bmp.UnlockBits(bmpData);
//Return the bitmap
return bmp;
しかし、BitmapDataクラスは現在Windows8には存在しません。同じための別の方法を提案してください。
ありがとう、パンカイ