/// <summary> /// Returns the image processing command. /// </summary> /// <returns>The image processing command.</returns> public override ProcessingCommandBase GetProcessingCommand() { ClearImageCommand command = ImageProcessingCommandFactory.CreateClearImageCommand(_imageViewer.Image); command.FillColor = fillColorPanelControl.Color; return(command); }
/// <summary> /// Returns "Crop to custom selection" composite command. /// </summary> /// <param name="path">Custom selection path.</param> /// <param name="pathBounds">Selection path bounds.</param> /// <param name="crop">Crop command.</param> /// <returns>Crop command for custom selection.</returns> ProcessingCommandBase GetCropToPathCommand( GraphicsPath path, RectangleF pathBounds, CropCommand crop) { Rectangle viewerImageRect = new Rectangle(0, 0, _viewer.Image.Width, _viewer.Image.Height); crop.RegionOfInterest = new RegionOfInterest(GetBoundingRect(RectangleF.Intersect(pathBounds, viewerImageRect))); // overlay command _overlayImage = crop.Execute(_viewer.Image); OverlayCommand overlay = new OverlayCommand(_overlayImage); // overlay with path command ProcessPathCommand overlayWithPath = new ProcessPathCommand(overlay, path); // clear image command ClearImageCommand clearImage = new ClearImageCommand(Color.Transparent); // create composite command: clear, overlay with path, crop return(new CompositeCommand(clearImage, overlayWithPath, crop)); }