protected unsafe void ProcessFrame(ColorImageFrame frame)
{
var bytes = new byte[frame.PixelDataLength];
frame.CopyPixelDataTo(bytes);
BitmapData bitmapData = this.CurrentValue.LockBits(new System.Drawing.Rectangle(0, 0, this.Width, this.Height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
byte* pDest = (byte*)bitmapData.Scan0.ToPointer();
int pointer = 0;
var maxIndex = this.Width * this.Height;
for (int index = 0; index < maxIndex; index++)
{
pDest[0] = bytes[pointer];
pDest[1] = bytes[pointer + 1];
pDest[2] = bytes[pointer + 2];
pDest += 3;
pointer += 4;
}
this.CurrentValue.UnlockBits(bitmapData);
this.OnNewDataAvailable();
}
}