VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.UI.VisualTools Namespace / ImageProcessingTool Class
Members Example



In This Topic
    ImageProcessingTool Class
    In This Topic
    Visual tool for previewing results of image processing in image viewer. Image processing can be done on the whole image or image region.
    Object Model
    ImageProcessingTool ClassIInteractionController InterfaceVintasoftImage ClassImageViewer ClassIInteractionController InterfaceProcessingCommandBase ClassRectangularObjectTransformer Class
    Syntax
    Remarks
    Image processing result can be previewed in image viewer as follows:
    • place the mouse to the desired position
    • press the action button (VisualTool.ActionButton) and select the "image processing" region by holding the action button
    • release the action button and result of image processing will be shown in selected region

    Image can be processed in image viewer as follows:
    • place the mouse to the desired position
    • press the action button (VisualTool.ActionButton) and select the "image processing" region by holding the action button
    • release the action button and result of image processing will be shown in viewer
    • press the "Execute Processing" button or call ExecuteProcessing method and selected region of image will be processed

    If VisualTool.ActionButton is set to the right mouse button, context menu during action can be disabled with the VisualTool.DisableContextMenu property.
    Example
    This example shows how to add the visual tool, which applies the image processing command (invert) to an image region in image viewer, to the image viewer.
    ''' <summary>
    ''' Adds the visual tool, which applies the image processing command (invert) to an image region in image viewer,
    ''' to the image viewer.
    ''' </summary>
    ''' <param name="viewer">The image viewer.</param>
    ''' <param name="processSourceImage">Determines that processing command must be applied to the source image.</param>
    Public Sub AddVisualToolForProcessingImageRegionInImageViewer(imageViewer As Vintasoft.Imaging.UI.ImageViewer, processSourceImage As Boolean)
        ' create an instance of the ImageProcessingTool class
        Dim imageProcessingTool As New Vintasoft.Imaging.UI.VisualTools.ImageProcessingTool()
        ' set the region of interest on the image
        imageProcessingTool.Rectangle = New System.Drawing.Rectangle(50, 50, 250, 150)
        ' enable preview of image processing on the image viewer
        imageProcessingTool.UseViewerZoomForPreviewProcessing = True
        ' specify that visual tool must apply the image processing command (invert) to the image region in image viewer
        imageProcessingTool.ProcessingCommand = New Vintasoft.Imaging.ImageProcessing.Color.InvertCommand()
                
        ' set the tool as the current tool of the ImageViewer
        imageViewer.VisualTool = imageProcessingTool
                
        ' if source image must be also inverted
        If processSourceImage Then
            ' applies the image processing command (invert) to the region of source image
            imageProcessingTool.ExecuteProcessing()
        End If
    End Sub
    /// <summary>
    /// Adds the visual tool, which applies the image processing command (invert) to an image region in image viewer,
    /// to the image viewer.
    /// </summary>
    /// <param name="viewer">The image viewer.</param>
    /// <param name="processSourceImage">Determines that processing command must be applied to the source image.</param>
    public void AddVisualToolForProcessingImageRegionInImageViewer(
        Vintasoft.Imaging.UI.ImageViewer imageViewer,
        bool processSourceImage)
    {
        // create an instance of the ImageProcessingTool class
        Vintasoft.Imaging.UI.VisualTools.ImageProcessingTool imageProcessingTool =
            new Vintasoft.Imaging.UI.VisualTools.ImageProcessingTool();
        // set the region of interest on the image
        imageProcessingTool.Rectangle = new System.Drawing.Rectangle(50, 50, 250, 150);
        // enable preview of image processing on the image viewer
        imageProcessingTool.UseViewerZoomForPreviewProcessing = true;
        // specify that visual tool must apply the image processing command (invert) to the image region in image viewer
        imageProcessingTool.ProcessingCommand = 
            new Vintasoft.Imaging.ImageProcessing.Color.InvertCommand();
                
        // set the tool as the current tool of the ImageViewer
        imageViewer.VisualTool = imageProcessingTool;
                
        // if source image must be also inverted
        if (processSourceImage)
            // applies the image processing command (invert) to the region of source image
            imageProcessingTool.ExecuteProcessing();
    }
    Inheritance Hierarchy
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also