/// <summary> /// Starts the preview. /// </summary> public void StartPreview() { // if current tool is CustomSelectionTool if (_viewer.VisualTool is CustomSelectionTool) { CustomSelectionTool selectionTool = (CustomSelectionTool)_viewer.VisualTool; RectangleF selectionBBox = RectangleF.Empty; if (selectionTool.Selection != null) { selectionBBox = selectionTool.Selection.GetBoundingBox(); } if (selectionBBox.Width >= 1 && selectionBBox.Height >= 1) { _selectionRegionView = selectionTool.Selection.View; _processedSelectionRegionView = new SelectionRegionViewWithImageProcessingPreview(); _processedSelectionRegionView.UseViewerZoomForProcessing = UseCurrentViewerZoomWhenPreviewProcessing; selectionTool.Selection.View = _processedSelectionRegionView; _isPreviewStarted = true; return; } } // set current tool to ImageProcessingTool _viewerTool = _viewer.VisualTool; _rectangularPreview = new ImageProcessingTool(); Rectangle imageRect = new System.Drawing.Rectangle(0, 0, _viewer.Image.Width, _viewer.Image.Height); Rectangle rect = imageRect; if (_viewer.VisualTool is RectangularSelectionTool) { RectangularSelectionTool rectangularSelection = (RectangularSelectionTool)_viewer.VisualTool; if (!rectangularSelection.Rectangle.Size.IsEmpty) { if (_viewer.VisualTool is RectangularSelectionToolWithCopyPaste) { rect = rectangularSelection.Rectangle; } _rectangularSelectionToolRect = rectangularSelection.Rectangle; } } _rectangularPreview.UseViewerZoomForPreviewProcessing = UseCurrentViewerZoomWhenPreviewProcessing; _viewer.VisualTool = _rectangularPreview; _rectangularPreview.Rectangle = rect; if (rect == imageRect) { _rectangularPreview.InteractionController = null; } _isPreviewStarted = true; }
private void OpenImageProcessingTool(object sender, RoutedEventArgs e) { ImageProcessingTool iTool = new ImageProcessingTool(_imageProcessingPack); iTool.Show(); }