Initializes a new InvertedTextCommand class object with explicit parameters.
Syntax
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 Basic | Copy 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")
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