/// <summary>
        /// Crops the capture to the specified rectangle (with Bitmap coordinates!)
        /// </summary>
        /// <param name="cropRectangle">Rectangle with bitmap coordinates</param>
        public bool Crop(Rectangle cropRectangle)
        {
            LOG.Debug("Cropping to: " + cropRectangle.ToString());
            if (ImageHelper.Crop(ref _image, ref cropRectangle))
            {
                _location = cropRectangle.Location;
                // Change mouse location according to the cropRegtangle (including screenbounds) offset
                MoveMouseLocation(-cropRectangle.Location.X, -cropRectangle.Location.Y);
                // Move all the elements
                // TODO: Enable when the elements are usable again.
                // MoveElements(-cropRectangle.Location.X, -cropRectangle.Location.Y);

                // Remove invisible elements
                List <ICaptureElement> newElements = new List <ICaptureElement>();
                foreach (ICaptureElement captureElement in _elements)
                {
                    if (captureElement.Bounds.IntersectsWith(cropRectangle))
                    {
                        newElements.Add(captureElement);
                    }
                }
                _elements = newElements;

                return(true);
            }
            return(false);
        }
Exemple #2
0
 /// <summary>
 /// Crops the capture to the specified rectangle (with Bitmap coordinates!)
 /// </summary>
 /// <param name="cropRectangle">Rectangle with bitmap coordinates</param>
 public bool Crop(Rectangle cropRectangle)
 {
     LOG.Debug("Cropping to: " + cropRectangle.ToString());
     if (ImageHelper.Crop(ref image, ref cropRectangle))
     {
         location = cropRectangle.Location;
         // Change mouse location according to the cropRegtangle (including screenbounds) offset
         MoveMouseLocation(-cropRectangle.Location.X, -cropRectangle.Location.Y);
         return(true);
     }
     return(false);
 }