public override PixelBuffer ReadPixels(PixelFormat format, Geometry.Rectangle rect) { BitmapData data = mImage.LockBits(Interop.Convert(rect), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); if (format == PixelFormat.Any) { format = PixelFormat.BGRA8888; } PixelBuffer buffer = new PixelBuffer(format, rect.Size); byte[] bytes = new byte[4 * rect.Width * rect.Height]; Marshal.Copy(data.Scan0, bytes, 0, bytes.Length); mImage.UnlockBits(data); buffer.SetData(bytes, PixelFormat.BGRA8888); return(buffer); }