public event EventHandler<ColorResolutionCommandDataEventArgs> Data typedef void (^LTColorResolutionCommandDataEvent)(LTRasterImage * _Nullable image, NSInteger lines, NSData *data, BOOL *cancel)- (BOOL)run:(LTRasterImage *)imageprogress:(nullable LTRasterCommandProgress)progressHandlerdataEvent:(nullable LTColorResolutionCommandDataEvent)dataEventHandlererror:(NSError **)error
synchronized public void addColorResolutionCommandDataListener(ColorResolutionCommandDataListener listener)synchronized public void removeColorResolutionCommandDataListener(ColorResolutionCommandDataListener listener)
public:event EventHandler<ColorResolutionCommandDataEventArgs^>^ Data
def Data(sender,e): # sender: ColorResolutionCommand e: ColorResolutionCommandDataEventArgs The event handler receives an argument of type ColorResolutionCommandDataEventArgs containing data related to this event. The following ColorResolutionCommandDataEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Cancel | Gets or sets a value indicating whether to abort the color resolution command. |
You can use this event to handle the converted image data that the ColorResolutionCommand has written to a buffer.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;public void ColorResolutionCommandExample(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");string destFileName1 = Path.Combine(LEAD_VARS.ImagesDir, "Image1_colorres8.bmp");string destFileName2 = Path.Combine(LEAD_VARS.ImagesDir, "Image1_colorres4.bmp");// Load the source image from diskRasterImage image = codecs.Load(srcFileName);// First color-res it to 8 bits per pixel using the Netscape palette into a seperate imageColorResolutionCommand cmd = new ColorResolutionCommand();cmd.Mode = ColorResolutionCommandMode.CreateDestinationImage;cmd.BitsPerPixel = 8;cmd.Order = RasterByteOrder.Rgb;cmd.DitheringMethod = RasterDitheringMethod.None;cmd.PaletteFlags = ColorResolutionCommandPaletteFlags.UsePalette;cmd.SetPalette(RasterPalette.Netscape());cmd.Run(image);RasterImage destImage = cmd.DestinationImage;Assert.IsTrue(destImage.BitsPerPixel == 8);// Save it to diskcodecs.Save(destImage, destFileName1, RasterImageFormat.Bmp, 8);destImage.Dispose();// Now color-res the image in-place to 4-bits per pixel using the Optimized palettecmd.Mode = ColorResolutionCommandMode.InPlace;cmd.BitsPerPixel = 4;cmd.Order = RasterByteOrder.Rgb;cmd.DitheringMethod = RasterDitheringMethod.None;cmd.PaletteFlags = ColorResolutionCommandPaletteFlags.Optimized;cmd.Run(image);Assert.IsTrue(image.BitsPerPixel == 4);// Save it to diskcodecs.Save(image, destFileName2, RasterImageFormat.Bmp, 4);// Clean UpdestImage.Dispose();image.Dispose();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
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
