VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.UI.VisualTools Namespace / CurvilinearSelectionRegion Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
    CurvilinearSelectionRegion Class
    In This Topic
    Represents the current selection, which is defined by a curve, in an image viewer. The selection can be moved, resized, rotated, skewed and distorted. Also the selection point list can be edited.
    Object Model
    SelectionRegionView IInteractionController IInteractionController IInteractionController CurvilinearSelectionRegion
    Syntax
    'Declaration
    
    Public Class CurvilinearSelectionRegion
       Inherits SelectionRegionBase
    
    
    public class CurvilinearSelectionRegion : SelectionRegionBase
    
    
    public __gc class CurvilinearSelectionRegion : public SelectionRegionBase*
    
    
    public ref class CurvilinearSelectionRegion : public SelectionRegionBase^
    
    
    Example

    This C#/VB.NET code shows how to execute image processing command on the curvilinear area of image.

    
    Class SelectionRegionProcessingExample
        ''' <summary>
        ''' Executes blur and invert commands on the curvilinear area of image.
        ''' </summary>
        Public Sub RunExample(image As Vintasoft.Imaging.VintasoftImage)
            ' create CurvilinearSelectionRegion
            Dim selection As New Vintasoft.Imaging.UI.VisualTools.CurvilinearSelectionRegion(New System.Drawing.PointF() {New System.Drawing.PointF(100, 100), New System.Drawing.PointF(100, 200), New System.Drawing.PointF(200, 200), New System.Drawing.PointF(200, 100)})
    
            ' execute blur command using selection
            ExecuteProcessing(New Vintasoft.Imaging.ImageProcessing.Effects.MotionBlurCommand(), image, selection)
    
            ' create point-based object transformer
            Dim transformer As New Vintasoft.Imaging.UI.VisualTools.UserInteraction.PointBasedObjectPointTransformer(selection)
            ' set point-based object transformer as transformer of current selection
            selection.TransformInteractionController = transformer
    
            ' insert point to selection
            transformer.InsertPoint(New System.Drawing.PointF(150, 150), 0)
    
            ' translate selection points
            transformer.TranslatePoints(100, 100)
    
            ' execute invert command using selection
            ExecuteProcessing(New Vintasoft.Imaging.ImageProcessing.Color.InvertCommand(), image, selection)
        End Sub
    
        ''' <summary>
        ''' Executes image processing command on region of interest of image.
        ''' </summary>
        Private Sub ExecuteProcessing(command As Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase, image As Vintasoft.Imaging.VintasoftImage, selectionRegion As Vintasoft.Imaging.UI.VisualTools.SelectionRegionBase)
            Using path As System.Drawing.Drawing2D.GraphicsPath = selectionRegion.GetAsGraphicsPath()
                Dim processPath As New Vintasoft.Imaging.ImageProcessing.ProcessPathCommand(command, New Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsPath(path, False))
                processPath.ExecuteInPlace(image)
            End Using
        End Sub
    End Class
    
    
    
    class SelectionRegionProcessingExample
    {
        /// <summary>
        /// Executes blur and invert commands on the curvilinear area of image.
        /// </summary>
        public void RunExample(Vintasoft.Imaging.VintasoftImage image)
        {
            // create CurvilinearSelectionRegion
            Vintasoft.Imaging.UI.VisualTools.CurvilinearSelectionRegion selection = 
                new Vintasoft.Imaging.UI.VisualTools.CurvilinearSelectionRegion(
                    new System.Drawing.PointF[] { 
                    new System.Drawing.PointF(100, 100), new System.Drawing.PointF(100, 200),
                    new System.Drawing.PointF(200, 200), new System.Drawing.PointF(200, 100) });
    
            // execute blur command using selection
            ExecuteProcessing(new Vintasoft.Imaging.ImageProcessing.Effects.MotionBlurCommand(), 
                image, selection);
    
            // create point-based object transformer
            Vintasoft.Imaging.UI.VisualTools.UserInteraction.PointBasedObjectPointTransformer transformer =
                new Vintasoft.Imaging.UI.VisualTools.UserInteraction.PointBasedObjectPointTransformer(selection);
            // set point-based object transformer as transformer of current selection
            selection.TransformInteractionController = transformer;
    
            // insert point to selection
            transformer.InsertPoint(new System.Drawing.PointF(150, 150), 0);
    
            // translate selection points
            transformer.TranslatePoints(100, 100);
    
            // execute invert command using selection
            ExecuteProcessing(new Vintasoft.Imaging.ImageProcessing.Color.InvertCommand(), 
                image, selection);
        }
    
        /// <summary>
        /// Executes image processing command on region of interest of image.
        /// </summary>
        private void ExecuteProcessing(
            Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase command,
            Vintasoft.Imaging.VintasoftImage image,
            Vintasoft.Imaging.UI.VisualTools.SelectionRegionBase selectionRegion)
        {
            using (System.Drawing.Drawing2D.GraphicsPath path = selectionRegion.GetAsGraphicsPath())
            {
                Vintasoft.Imaging.ImageProcessing.ProcessPathCommand processPath = 
                    new Vintasoft.Imaging.ImageProcessing.ProcessPathCommand(command, new Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsPath(path, false));
                processPath.ExecuteInPlace(image);
            }
        }
    }
    
    

    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.UI.VisualTools.SelectionRegionBase
          Vintasoft.Imaging.UI.VisualTools.CurvilinearSelectionRegion

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also