Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SmoothCommandEventArgs Constructor
See Also  Example
Leadtools.ImageProcessing.Core Namespace > SmoothCommandEventArgs Class : SmoothCommandEventArgs Constructor



image
RasterImage object that references the affected image.
bumpNick
Value that indicates whether to remove bumps or fill in nicks.
startRow
The starting row of the bump or nick. The rows are zero-based.
startColumn
The starting column of the bump or nick. The columns are zero-based.
length
Length (in pixels) of the bump or nick.
direction
Flag that indicates whether the element being smoothed is vertical or horizontal.
Initializes a new SmoothCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal image As RasterImage, _
   ByVal bumpNick As SmoothCommandBumpNickType, _
   ByVal startRow As Integer, _
   ByVal startColumn As Integer, _
   ByVal length As Integer, _
   ByVal direction As SmoothCommandDirectionType _
)
Visual Basic (Usage)Copy Code
Dim image As RasterImage
Dim bumpNick As SmoothCommandBumpNickType
Dim startRow As Integer
Dim startColumn As Integer
Dim length As Integer
Dim direction As SmoothCommandDirectionType
 
Dim instance As SmoothCommandEventArgs(image, bumpNick, startRow, startColumn, length, direction)
C# 
public SmoothCommandEventArgs( 
   RasterImage image,
   SmoothCommandBumpNickType bumpNick,
   int startRow,
   int startColumn,
   int length,
   SmoothCommandDirectionType direction
)
C++/CLI 
public:
SmoothCommandEventArgs( 
   RasterImage image,
   SmoothCommandBumpNickType bumpNick,
   int startRow,
   int startColumn,
   int length,
   SmoothCommandDirectionType direction
)

Parameters

image
RasterImage object that references the affected image.
bumpNick
Value that indicates whether to remove bumps or fill in nicks.
startRow
The starting row of the bump or nick. The rows are zero-based.
startColumn
The starting column of the bump or nick. The columns are zero-based.
length
Length (in pixels) of the bump or nick.
direction
Flag that indicates whether the element being smoothed is vertical or horizontal.

Example

Run the SmoothCommand on an image.

Visual BasicCopy Code
Public WithEvents smoothEventExample_S4 As SmoothCommand
Public Sub SmoothCommandEventArgsExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "clean.tif")

   ' Prepare the command
   smoothEventExample_S4 = New SmoothCommand(SmoothCommandFlags.FavorLong Or SmoothCommandFlags.SingleRegion Or SmoothCommandFlags.LeadRegion, 2)
   smoothEventExample_S4.Run(leadImage)

   RasterCodecs.Shutdown()
End Sub

Private Sub SmoothEventExample_SmoothCommand(ByVal sender As Object, ByVal e As SmoothCommandEventArgs) Handles smoothEventExample_S4.Smooth
   Dim ee As SmoothCommandEventArgs = New SmoothCommandEventArgs(e.Image, e.BumpNick, e.StartRow, e.StartColumn, e.Length, e.Direction)

   Dim BumpOrNeck As String
   If (ee.BumpNick = SmoothCommandBumpNickType.Bump) Then
      BumpOrNeck = "Bump"
   Else
      BumpOrNeck = "Neck"
   End If

   Dim Direction As String
   If (ee.Direction = SmoothCommandDirectionType.Horizontal) Then
      Direction = "Horizontal"
   Else
      Direction = "Vertical"
   End If

   e.Status = RemoveStatus.Remove

   MessageBox.Show("The width of the image is: " & e.Image.Width & Chr(13) & "The height of the image is: " & e.Image.Height & Chr(13) & " Bump Or Neck : " & BumpOrNeck & Chr(13) & "Direction : " & Direction)
End Sub
C#Copy Code
public void SmoothCommandEventArgsExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "clean.tif"); 
 
   // Prepare the command 
   SmoothCommand command = new SmoothCommand(SmoothCommandFlags.FavorLong | SmoothCommandFlags.SingleRegion | SmoothCommandFlags.LeadRegion, 2); 
   command.Smooth += new EventHandler<SmoothCommandEventArgs>(SmoothEventExample_S4); 
   command.Run(image); 
 
   RasterCodecs.Shutdown(); 

 
private void SmoothEventExample_S4(object sender, SmoothCommandEventArgs e) 

   SmoothCommandEventArgs ee = new SmoothCommandEventArgs(e.Image, e.BumpNick, e.StartRow, e.StartColumn, e.Length, e.Direction); 
 
   string BumpOrNeck; 
   if (ee.BumpNick == SmoothCommandBumpNickType.Bump) 
      BumpOrNeck = "Bump"; 
   else 
      BumpOrNeck = "Neck"; 
 
   string Direction; 
   if (ee.Direction == SmoothCommandDirectionType.Horizontal) 
      Direction = "Horizontal"; 
   else 
      Direction = "Vertical"; 
 
   e.Status = RemoveStatus.Remove; 
 
   MessageBox.Show("The width of the image is: " + e.Image.Width + "\n" + "The height of the image is: " + e.Image.Height + "\n" + " Bump Or Neck : " + BumpOrNeck + "\n" + "Direction : " + Direction); 
}

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also