/// <summary> /// Creates a new PixelData array. /// </summary> /// <param name="frame"></param> public void Update(ReplayDepthImageFrame frame) { PixelData = new short[frame.PixelDataLength]; frame.CopyPixelDataTo(PixelData); if (depthFrame32 == null) { depthFrame32 = new byte[frame.Width * frame.Height * 4]; } if (Bitmap == null) { Bitmap = new WriteableBitmap(frame.Width, frame.Height, 96, 96, PixelFormats.Bgra32, null); } ConvertDepthFrame(PixelData); int stride = Bitmap.PixelWidth * Bitmap.Format.BitsPerPixel / 8; Int32Rect dirtyRect = new Int32Rect(0, 0, Bitmap.PixelWidth, Bitmap.PixelHeight); Bitmap.WritePixels(dirtyRect, depthFrame32, stride, 0); RaisePropertyChanged(() => Bitmap); }
/// <summary> /// Updates the depth frame pixel data. Each pixel contains both the player and the depth /// information. /// </summary> /// <param name="frame"></param> public void UpdatePixelData(ReplayDepthImageFrame frame) { if (DepthPixelData == null) DepthPixelData = new short[frame.PixelDataLength]; frame.CopyPixelDataTo(DepthPixelData); }