private static void CreateImageBitmap(XnMMapMetaData imageMd, out WriteableBitmap writeableBitmap, PixelFormat format) { var bmpWidth = (int)imageMd.FullXRes; var bmpHeight = (int)imageMd.FullYRes; writeableBitmap = new WriteableBitmap(bmpWidth, bmpHeight, 96.0, 96.0, format, null); }
private static void CopyWritableBitmap(XnMMapMetaData imageMd, WriteableBitmap b) { int dataSize = (int)imageMd.DataSize; IntPtr data = imageMd.Data; var rect = new Int32Rect((int)imageMd.XOffset, (int)imageMd.YOffset, (int)imageMd.XRes, (int)imageMd.YRes); b.WritePixels(rect, data, dataSize, b.BackBufferStride); /* * b.Lock(); * NativeMethods.RtlMoveMemory(b.BackBuffer, data, dataSize); * b.Unlock(); */ }
private static void CreateImageBitmap(XnMMapMetaData imageMd, out WriteableBitmap writeableBitmap) { var format = MapPixelFormat(imageMd.PixelFormat); CreateImageBitmap(imageMd, out writeableBitmap, format); }
private static void CopyWritableBitmap(XnMMapMetaData imageMd, WriteableBitmap b) { int dataSize = (int) imageMd.DataSize; IntPtr data = imageMd.Data; var rect = new Int32Rect((int) imageMd.XOffset, (int) imageMd.YOffset, (int) imageMd.XRes, (int) imageMd.YRes); b.WritePixels(rect, data, dataSize, b.BackBufferStride); /* b.Lock(); NativeMethods.RtlMoveMemory(b.BackBuffer, data, dataSize); b.Unlock(); */ }