void initialize() { _fps = 0; _path = null; Frame = new System.Drawing.RectangleF(0, 0, 320, 480 - 54); // important - it needs to be transparent so the camera preview shows through! Opaque = false; BackgroundColor = UIColor.Clear; // allocating bitmap buffer _buffer = new RawBitmap((int)Frame.Width, (int)Frame.Height); _drawnImage = new RawBitmap((int)Frame.Width, (int)Frame.Height); // creating checkerboard mask image using (var checkerBoardImage = new RawBitmap((int)Bounds.Size.Width, (int)Bounds.Size.Height)) { for (int y = 0; y < checkerBoardImage.Height; y += 2) { for (int x = 0; x < checkerBoardImage.Width; x += 2) { checkerBoardImage.WritePixel(x, y, 255); } } for (int y = 1; y < checkerBoardImage.Height; y += 2) { for (int x = 1; x < checkerBoardImage.Width; x += 2) { checkerBoardImage.WritePixel(x, y, 255); } } _maskImage = checkerBoardImage.Context.ToImage(); } }
void initialize() { _fps = 0; _path = null; Frame = new System.Drawing.RectangleF(0, 0, 320, 480 - 54); // important - it needs to be transparent so the camera preview shows through! Opaque = false; BackgroundColor = UIColor.Clear; // allocating bitmap buffer _buffer = new RawBitmap((int)Frame.Width, (int)Frame.Height); _drawnImage = new RawBitmap((int)Frame.Width, (int)Frame.Height); // creating checkerboard mask image using (var checkerBoardImage = new RawBitmap((int)Bounds.Size.Width, (int)Bounds.Size.Height)) { for (int y = 0; y < checkerBoardImage.Height; y += 2) { for (int x = 0; x < checkerBoardImage.Width; x += 2) { checkerBoardImage.WritePixel(x, y, 255); } } for (int y = 1; y < checkerBoardImage.Height; y += 2) { for (int x = 1; x < checkerBoardImage.Width; x += 2) { checkerBoardImage.WritePixel(x, y, 255); } } _maskImage = checkerBoardImage.Context.ToImage(); } }
protected override void Dispose(bool disposing) { if (null != _timer) { _timer.Invalidate(); _timer.Dispose(); _timer = null; } if (null != _buffer) { _buffer.Dispose(); _buffer = null; } if (null != _drawnImage) { _drawnImage.Dispose(); _drawnImage = null; } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (null != _timer) { _timer.Invalidate(); _timer.Dispose(); _timer = null; } if (null != _buffer) { _buffer.Dispose(); _buffer = null; } if (null != _drawnImage) { _drawnImage.Dispose(); _drawnImage = null; } base.Dispose(disposing); }