public event EventHandler<RasterImageChangedEventArgs> Changed extern NSString *const LTRasterImageChangedNotificationextern NSString *const LTRasterImageChangedNotificationFlags
synchronized public void addChangedListener(RasterImageChangedListener listener)synchronized public void removeChangedListener(RasterImageChangedListener listener)
public:event EventHandler<RasterImageChangedEventArgs^>^ Changed
def Changed(sender,e): # sender: RasterImage e: RasterImageChangedEventArgs The event handler receives an argument of type RasterImageChangedEventArgs containing data related to this event. The following RasterImageChangedEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Flags | Gets the flags for the Changed event. |
When the data or attributes of a RasterImage object changes, the Changed event is fired with information of what has changed. For example, you can subscribe to this event to get notified when the RasterImage object has been changed and need to be updated in your user interface by re-painting it.
For more information, refer to RasterImageChangedEventArgs.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;using Leadtools.ImageProcessing.Color;using Leadtools.Dicom;using Leadtools.Drawing;using Leadtools.Controls;using Leadtools.Svg;public void ChangedExample(){RasterCodecs codecs = new RasterCodecs();string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");// Load the imageRasterImage img = codecs.Load(srcFileName);// Subscribe to the Changed event of this imageimg.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);// Call a few methods and image processing commands that changes the imageConsole.WriteLine("Calling FlipViewPerspective");img.FlipViewPerspective(true);Console.WriteLine("Calling RotateViewPerspective");img.RotateViewPerspective(90);Console.WriteLine("Calling FlipCommand");FlipCommand flip = new FlipCommand(true);flip.Run(img);// Now disable firing the events and call the methods againConsole.WriteLine("Disabling the events");img.DisableEvents();Console.WriteLine("Calling FlipViewPerspective");img.FlipViewPerspective(true);Console.WriteLine("Calling RotateViewPerspective");img.RotateViewPerspective(90);Console.WriteLine("Calling FlipCommand while");flip.Run(img);// Re-enable the events and fire it manuallyConsole.WriteLine("Re-enabling the events");img.EnableEvents();Console.WriteLine("Firing the event manually");RasterImageChangedFlags flags = RasterImageChangedFlags.Data | RasterImageChangedFlags.ViewPerspective;RasterImageChangedEventArgs e = new RasterImageChangedEventArgs(flags);img.OnChanged(e);// Clean upimg.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);img.Dispose();codecs.Dispose();}void img_Changed(object sender, RasterImageChangedEventArgs e){// Show the changed flagsConsole.WriteLine("Changed: {0}", e.Flags);}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}
import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.util.ArrayList;import java.util.List;import org.junit.*;import org.junit.runner.JUnitCore;import org.junit.runner.Result;import org.junit.runner.notification.Failure;import static org.junit.Assert.*;import leadtools.*;import leadtools.codecs.*;import leadtools.imageprocessing.core.*;import leadtools.svg.*;import leadtools.imageprocessing.CloneCommand;import leadtools.imageprocessing.FillCommand;import leadtools.imageprocessing.FlipCommand;import leadtools.imageprocessing.GrayscaleCommand;import leadtools.imageprocessing.color.InvertCommand;import leadtools.imageprocessing.color.PosterizeCommand;public void changedExample() {final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";RasterCodecs codecs = new RasterCodecs();String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "Image1.cmp");// Load the imageRasterImage img = codecs.load(srcFileName);// Subscribe to the Changed event of this imageimg.addChangedListener(img_Changed);// Call a few methods and image processing commands that changes the imageSystem.out.println("Calling FlipViewPerspective");img.flipViewPerspective(true);System.out.println("Calling RotateViewPerspective");img.rotateViewPerspective(90);System.out.println("Calling FlipCommand");FlipCommand flip = new FlipCommand(true);flip.run(img);// Now disable firing the events and call the methods againSystem.out.println("Disabling the events");img.disableEvents();System.out.println("Calling FlipViewPerspective");img.flipViewPerspective(true);System.out.println("Calling RotateViewPerspective");img.rotateViewPerspective(90);System.out.println("Calling FlipCommand while");flip.run(img);// Re-enable the events and fire it manuallySystem.out.println("Re-enabling the events");img.enableEvents();System.out.println("Firing the event manually");RasterImageChangedFlags flags = RasterImageChangedFlags.forValue(RasterImageChangedFlags.DATA | RasterImageChangedFlags.VIEW_PERSPECTIVE);RasterImageChangedEvent e = new RasterImageChangedEvent(flags,RasterImageChangedFlags.DATA | RasterImageChangedFlags.VIEW_PERSPECTIVE);img.onChanged(e);// Save itcodecs.save(img, srcFileName, RasterImageFormat.CMP, 0);// Clean upimg.removeChangedListener(img_Changed);img.dispose();codecs.dispose();assertTrue("file unsuccessfully saved to " + srcFileName, (new File(srcFileName)).exists());System.out.printf("File saved successfully to %s%n", srcFileName);}RasterImageChangedListener img_Changed = new RasterImageChangedListener() {@Overridepublic void onImageChangedAlert(RasterImageChangedEvent arg0) {System.out.printf("Changed: %s%n", arg0.getFlags());}};
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
