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
Syntax
Remarks
Image processing result can be previewed in image viewer as follows:
- place the mouse to the desired position
- press the action button (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 (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
ActionButton is set to the right mouse button, context menu during action can be disabled with the
DisableContextMenu property.
Example
This C#/VB.NET code 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="imageViewer">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="imageViewer">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: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
See Also