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




Handles each dot found by DotRemoveCommand.

Syntax

Visual Basic (Declaration) 
Public Class DotRemoveCommandEventArgs 
   Inherits EventArgs
Visual Basic (Usage)Copy Code
Dim instance As DotRemoveCommandEventArgs
C# 
public class DotRemoveCommandEventArgs : EventArgs 
Managed Extensions for C++ 
public __gc class DotRemoveCommandEventArgs : public EventArgs 
C++/CLI 
public ref class DotRemoveCommandEventArgs : public EventArgs 

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); 
         } 
      }

Inheritance Hierarchy

System.Object
   System.EventArgs
      Leadtools.ImageProcessing.Core.DotRemoveCommandEventArgs

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