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



image
RasterImage object that references the affected image.
region
Windows region representing the inverted text to be removed. Dispose of this region when it is no longer needed.
boundingRectangle
The bounding rectangle of the inverted text region being processed.
whiteCount
Total number of white pixels in the inverted text region being processed.
blackCount
Total number of black pixels in the inverted text region being processed.
Initializes a new InvertedTextCommand class object 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 InvertedTextCommandEventArgs(image, region, boundingRectangle, whiteCount, blackCount)
C# 
public InvertedTextCommandEventArgs( 
   RasterImage image,
   Region region,
   Rectangle boundingRectangle,
   int whiteCount,
   int blackCount
)
C++/CLI 
public:
InvertedTextCommandEventArgs( 
   RasterImage image,
   Region region,
   Rectangle boundingRectangle,
   int whiteCount,
   int blackCount
)

Parameters

image
RasterImage object that references the affected image.
region
Windows region representing the inverted text to be removed. Dispose of this region when it is no longer needed.
boundingRectangle
The bounding rectangle of the inverted text region being processed.
whiteCount
Total number of white pixels in the inverted text region being processed.
blackCount
Total number of black pixels in the inverted text region being processed.

Example

Runs the InvertedTextCommand on an image.

Visual BasicCopy Code
Public WithEvents invertedTextCommand_S4 As InvertedTextCommand
Public Sub InvertedTextCommandEventArgsExample()
   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
   invertedTextCommand_S4 = New InvertedTextCommand(InvertedTextCommandFlags.UseDpi Or InvertedTextCommandFlags.CallBackRegion, 5000, 500, 70, 95)
   invertedTextCommand_S4.Run(leadImage)

   RasterCodecs.Shutdown()
End Sub

Private Sub InvertedTextCommand_InvertedText_S4(ByVal sender As Object, ByVal e As InvertedTextCommandEventArgs) Handles invertedTextCommand_S4.InvertedText
   Dim ee As InvertedTextCommandEventArgs = New InvertedTextCommandEventArgs(e.Image, e.Region, e.BoundingRectangle, e.WhiteCount, e.BlackCount)
   e.Status = RemoveStatus.Remove
   If Not (e.Region Is Nothing) Then
      e.Image.AddGdiPlusRegionToRegion(Nothing, e.Region, RasterRegionCombineMode.AndNotRegion)
   End If
End Sub
C#Copy Code
public void InvertedTextCommandEventArgsExample() 

   // 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 
   InvertedTextCommand command = new InvertedTextCommand( InvertedTextCommandFlags.UseDpi | InvertedTextCommandFlags.CallBackRegion, 5000, 500, 70, 95); 
   command.InvertedText += new EventHandler<InvertedTextCommandEventArgs>(InvertedTextEvent_S4); 
   command.Run(image); 
 
   RasterCodecs.Shutdown(); 

 
private void InvertedTextEvent_S4(object sender, InvertedTextCommandEventArgs e) 

   InvertedTextCommandEventArgs ee = new InvertedTextCommandEventArgs(e.Image, e.Region, e.BoundingRectangle, e.WhiteCount, e.BlackCount); 
   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