Handles each dot found by
DotRemoveCommand.
Syntax
Visual Basic (Declaration) | |
---|
Public Class DotRemoveCommandEventArgs
Inherits EventArgs |
C# | |
---|
public class DotRemoveCommandEventArgs : EventArgs |
C++/CLI | |
---|
public ref class DotRemoveCommandEventArgs : public EventArgs |
Example
Run the DotRemoveCommand on an image.
Visual Basic | Copy Code |
---|
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(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif")
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)
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 |
---|
public void DotRemoveCommandEventArgsExample() { // 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 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
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