public void OverlaySnapshot(System.Drawing.Bitmap bmp) { long min_changed_date = DateTime.Now.Ticks - RELEVANT_HISTORY_TICK; int minXchanged = int.MaxValue; int maxXchanged = 0; int minYchanged = int.MaxValue; int maxYchanged = 0; //Take pixels for (int x = 0; x < _xdim; x++) { for (int y = 0; y < _ydim; y++) { if (_values[x, y] > min_changed_date) //Sensor was changed recently { if (x < minXchanged) { minXchanged = x; } if (x > maxXchanged) { maxXchanged = x; } if (y < minYchanged) { minYchanged = y; } if (y > maxYchanged) { maxYchanged = y; } var t = ScaleXY(x, y, bmp); RenderImage.SetMarkerAtPosition(bmp, t.Item1, t.Item2); } } } var minScale = ScaleXY(minXchanged, minYchanged, bmp); var maxScale = ScaleXY(maxXchanged, maxYchanged, bmp); RenderImage.SetBoundaryRect(bmp, minScale.Item1, minScale.Item2, maxScale.Item1, maxScale.Item2); }
public void SetImage(Bitmap img) { if (Program.CacheWorker.GetCacheMode() == ImageCacheWorker.CacheMode.Capture) { _lastMotionRect = Program.MotionDetectionWorker.GetMovingRegion(img); //Program.MotionDetectionWorker.OverlayDeltaToBitmap(img); RenderImage.SetBoundaryRect(img, _lastMotionRect.Left, _lastMotionRect.Top, _lastMotionRect.Right, _lastMotionRect.Bottom); //Program.MotionDetectionWorker.OverlayDeltaToBitmap(img); if (this.InvokeRequired) { InvokeUI(() => { screenCapture.Image = img; }); } else { screenCapture.Image = img; } } }
private void Render(Bitmap bmp, Rectangle r) { RenderImage.SetBoundaryRect(bmp, r.Left, r.Top, r.Right, r.Bottom); screenCapture.Image = bmp; }