Represents a collection of RasterCommands objects.
[DefaultMemberAttribute("Item")]
public class RasterCommandsList : IList<RasterCommand>, ICollection<RasterCommand>, IEnumerable<RasterCommand>, IEnumerable
Public Class RasterCommandsList
Implements System.Collections.Generic.IList(Of RasterCommand)
@interface LTRasterCommandsList : NSMutableArray<LTRasterCommand *>
public class RasterCommandsList implements List<IRasterCommand>
public ref class RasterCommandsList : System.Collections.Generic.IList<RasterCommand>
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Kernel;
public void RasterCommandsListExample()
{
using (RasterCodecs codecs = new RasterCodecs())
{
// Load an image
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")))
{
//Prepare the list
RasterCommandsList commandsList = new RasterCommandsList();
commandsList.CommandCompleted += new EventHandler<RasterCommandCompletedEventArgs>(CommandCompleted);
commandsList.Add(new Leadtools.ImageProcessing.Kernel.CropCommand(new LeadRect(100, 100, image.Width - 100, image.Height - 100)));
commandsList.Add(new InvertCommand());
// Run the command and save the result
commandsList.Run(image);
// Check the result image created, otherwise use the input image
if (commandsList.ResultImage != null)
{
codecs.Save(commandsList.ResultImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.bmp"), RasterImageFormat.Bmp, 24);
commandsList.ResultImage.Dispose();
}
else
{
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.bmp"), RasterImageFormat.Bmp, 24);
}
}
}
}
private void CommandCompleted(object sender, RasterCommandCompletedEventArgs e)
{
Console.WriteLine(e.Command.ToString());
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Kernel
Public Sub RasterCommandsListExample()
Using codecs As RasterCodecs = New RasterCodecs()
Using image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"))
' Prepare the list
Dim commandsList As RasterCommandsList = New RasterCommandsList()
AddHandler commandsList.CommandCompleted, AddressOf CommandCompleted
commandsList.Add(New CropCommand(New LeadRect(100, 100, image.Width - 100, image.Height - 100)))
commandsList.Add(New InvertCommand())
' Run the command And save the result
commandsList.Run(image)
' Check the result image created, otherwise use the input image
If commandsList.ResultImage IsNot Nothing Then
codecs.Save(commandsList.ResultImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.bmp"), RasterImageFormat.Bmp, 24)
commandsList.ResultImage.Dispose()
Else
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.bmp"), RasterImageFormat.Bmp, 24)
End If
End Using
End Using
End Sub
Private Sub CommandCompleted(ByVal sender As Object, ByVal e As RasterCommandCompletedEventArgs)
Console.WriteLine(e.Command.ToString())
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.