/// <summary> /// Method called to notify the plotting operation was finished /// </summary> /// <param name="pixelHistory">The pixel history tracker containing the information about the pixels that were modified during the operation</param> public void OperationFinished(PixelHistoryTracker pixelHistory) { if (pixelHistory != null && !_registerPixels) { UndoTask = new PerPixelUndoTask(_bitmap, _description, pixelHistory); } }
/// <summary> /// Called to notify this PaintTool that the mouse is being released /// </summary> /// <param name="e">The event args for this event</param> public override void MouseUp(MouseEventArgs e) { if (mouseDown) { Rectangle newArea = GetCurrentRectangle(true); pictureBox.Invalidate(newArea); // Draw the rectangle on the image now Rectangle rectArea = GetCurrentRectangle(false); if (rectArea.Width > 0 && rectArea.Height > 0) { Color color = (mouseButton == MouseButtons.Left ? _firstColor : _secondColor); PerPixelUndoTask task = PerformLineOperation(color, mouseDownAbsolutePoint, mouseAbsolutePoint, pictureBox.Bitmap, CompositingMode, Size, true); if (task.PixelHistoryTracker.PixelCount > 0) { pictureBox.OwningPanel.UndoSystem.RegisterUndo(task); pictureBox.MarkModified(); } } } mouseDown = false; }
/// <summary> /// Initializes a new instance of the PixelUndoTask with a specified undo task to use into this generator /// </summary> /// <param name="undoTask">The undo task to associate to this undo generator</param> /// <param name="ignoreDuplicatedPlots">Whether to ignore duplicated pixels during calls to PlottedPixel</param> public PlottingPaintUndoGenerator(PerPixelUndoTask undoTask, bool ignoreDuplicatedPlots = true) { IgnoreDuplicatedPlots = ignoreDuplicatedPlots; UndoTask = undoTask; }