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




image
RasterImage object that references the image to be modified.
region
Windows region representing the dot to be removed. It is the programmer's responsibility to dispose of this region when it is no longer needed.
boundingRectangle
The bounding rectangle of the dot being processed.
whiteCount
Total number of white pixels in the dot being processed.
blackCount
Total number of black pixels in the dot being processed.
Initializes a new DotRemoveCommand with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal image As RasterImage, _
   ByVal region As Region, _
   ByVal boundingRectangle As Rectangle, _
   ByVal whiteCount As Integer, _
   ByVal blackCount As Integer _
)
Visual Basic (Usage)Copy Code
Dim image As RasterImage
Dim region As Region
Dim boundingRectangle As Rectangle
Dim whiteCount As Integer
Dim blackCount As Integer
 
Dim instance As DotRemoveCommandEventArgs(image, region, boundingRectangle, whiteCount, blackCount)
C# 
public DotRemoveCommandEventArgs( 
   RasterImage image,
   Region region,
   Rectangle boundingRectangle,
   int whiteCount,
   int blackCount
)
Managed Extensions for C++ 
public: DotRemoveCommandEventArgs( 
   RasterImage image,
   Region region,
   Rectangle boundingRectangle,
   int whiteCount,
   int blackCount
)
C++/CLI 
public:
DotRemoveCommandEventArgs( 
   RasterImage image,
   Region region,
   Rectangle boundingRectangle,
   int whiteCount,
   int blackCount
)

Parameters

image
RasterImage object that references the image to be modified.
region
Windows region representing the dot to be removed. It is the programmer's responsibility to dispose of this region when it is no longer needed.
boundingRectangle
The bounding rectangle of the dot being processed.
whiteCount
Total number of white pixels in the dot being processed.
blackCount
Total number of black pixels in the dot being processed.

Example

Visual BasicCopy Code
ImageProcessing.Core.DotRemoveCommandEventArgs.DotRemoveCommandEventArgs
   Public WithEvents dotRemoveCommandCallback_S4 As DotRemoveCommand
   Public Sub DotRemoveCommandEventArgsExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Clean.tif")

      ' Prepare the command
      dotRemoveCommandCallback_S4 = New DotRemoveCommand(DotRemoveCommandFlags.UseSize Or DotRemoveCommandFlags.CallBackRegion, 1, 1, 10, 10)
      dotRemoveCommandCallback_S4.Run(leadImage)

      RasterCodecs.Shutdown()
   End Sub

   Private Sub DotRemoveCommand_DotRemove_S4(ByVal sender As Object, ByVal e As DotRemoveCommandEventArgs) Handles dotRemoveCommandCallback_S4.DotRemove
      Dim ee As DotRemoveCommandEventArgs = New DotRemoveCommandEventArgs(e.Image, e.Region, e.BoundingRectangle, e.WhiteCount, e.BlackCount)
      'Do not remove the speck if it contains any white pixels
      If (e.WhiteCount > 0) Then
         e.Status = RemoveStatus.NoRemove
      Else
         e.Status = RemoveStatus.Remove
      End If

      If Not (e.Region Is Nothing) Then
         e.Image.AddGdiPlusRegionToRegion(Nothing, e.Region, RasterRegionCombineMode.AndNotRegion)
      End If
   End Sub
C#Copy Code
ImageProcessing.Core.DotRemoveCommandEventArgs.DotRemoveCommandEventArgs 
      public void DotRemoveCommandEventArgsExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Clean.tif"); 
 
         // Prepare the command 
         DotRemoveCommand command = new DotRemoveCommand(DotRemoveCommandFlags.UseSize | DotRemoveCommandFlags.CallBackRegion, 1, 1, 10, 10); 
         command.DotRemove += new EventHandler<DotRemoveCommandEventArgs>(DotRemoveEvent_S4); 
         command.Run(image); 
 
         RasterCodecs.Shutdown(); 
      } 
 
      private void DotRemoveEvent_S4(object sender, DotRemoveCommandEventArgs e) 
      { 
         DotRemoveCommandEventArgs ee = new DotRemoveCommandEventArgs(e.Image, e.Region, e.BoundingRectangle, e.WhiteCount, e.BlackCount); 
         // Do not remove the speck if it contains any white pixels 
         if (e.WhiteCount > 0)  
         { 
            e.Status= RemoveStatus.NoRemove; 
         } 
         else  
         { 
            e.Status= RemoveStatus.Remove; 
         } 
 
         if(e.Region != null) 
         { 
            e.Image.AddGdiPlusRegionToRegion(null, e.Region, RasterRegionCombineMode.AndNotRegion); 
         } 
      }

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