LEADTOOLS(Leadtoolsアセンブリ)

フレームを表示

Changedイベント








画像データまたは属性が変わると、発生します。
構文
'Declaration
 
Public Event Changed As EventHandler(Of RasterImageChangedEventArgs)
'Usage
 
Dim instance As RasterImage
Dim handler As EventHandler(Of RasterImageChangedEventArgs)
 
AddHandler instance.Changed, handler
extern NSString *const LTRasterImageChangedNotification
extern NSString *const LTRasterImageChangedNotificationFlags
            
synchronized public void addChangedListener(RasterImageChangedListener listener)
synchronized public void removeChangedListener(RasterImageChangedListener listener)
            
add_Changed(function(sender, e))
remove_Changed(function(sender, e))

イベントデータ

イベントハンドラは、このイベントに関連するデータを格納するタイプRasterImageChangedEventArgsの引数を受け取ります。以下のRasterImageChangedEventArgsプロパティは、このイベントに特有の情報を提供します。

プロパティ説明
Flags Changedイベントのためにフラグを取得します。
解説

RasterImageオブジェクトのデータまたは属性が変更するとき、Changedイベントは変更したことの情報で発生されます。たとえば、RasterImageオブジェクトが変更されたとき通知されるためにこのイベントにサブスクライブすることができて、それを再描画することによってユーザーインターフェースで更新される必要があります。

詳細については、「RasterImageChangedEventArgs」を参照してください。

サンプル
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Core
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Controls
Imports Leadtools.Dicom
Imports Leadtools.Drawing
Imports Leadtools.Svg

      
Public Sub ChangedExample()
   Dim codecs As RasterCodecs = New RasterCodecs()
   Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")

   ' Load the image
   Dim img As RasterImage = codecs.Load(srcFileName)

   ' Subscribe to the Changed event of this image
   AddHandler img.Changed, AddressOf img_Changed

   ' Call a few methods and image processing commands that changes the image
   Console.WriteLine("Calling FlipViewPerspective")
   img.FlipViewPerspective(True)

   Console.WriteLine("Calling RotateViewPerspective")
   img.RotateViewPerspective(90)

   Console.WriteLine("Calling FlipCommand")
   Dim flip As FlipCommand = New FlipCommand(True)
   flip.Run(img)

   ' Now disable firing the events and call the methods again
   Console.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 manually
   Console.WriteLine("Re-enabling the events")
   img.EnableEvents()

   Console.WriteLine("Firing the event manually")
   Dim flags As RasterImageChangedFlags = RasterImageChangedFlags.Data Or RasterImageChangedFlags.ViewPerspective
   Dim e As RasterImageChangedEventArgs = New RasterImageChangedEventArgs(flags)

   img.OnChanged(e)

   ' Clean up
   RemoveHandler img.Changed, AddressOf img_Changed
   img.Dispose()
   codecs.Dispose()
End Sub

Private Sub img_Changed(ByVal sender As Object, ByVal e As RasterImageChangedEventArgs)
   ' Show the changed flags
   Console.WriteLine("Changed: {0}", e.Flags)
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
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(ImagesPath.Path, "Image1.cmp");

   // Load the image
   RasterImage img = codecs.Load(srcFileName);

   // Subscribe to the Changed event of this image
   img.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);

   // Call a few methods and image processing commands that changes the image
   Console.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 again
   Console.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 manually
   Console.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 up
   img.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);
   img.Dispose();
   codecs.Dispose();
}

void img_Changed(object sender, RasterImageChangedEventArgs e)
{
   // Show the changed flags
   Console.WriteLine("Changed: {0}", e.Flags);
}
RasterImageExamples.prototype.ChangedExample = function ()
{
   Tools.SetLicense();
   with ( Leadtools ) 
   {
      with (Leadtools.Codecs) {
         var codecs = new RasterCodecs();

         var srcFileName = "Assets\\Image1.cmp";

         // Load the image
         return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) {

            return codecs.loadAsync(LeadStreamFactory.create(loadFile));
         })
            .then(function (img) {

               // Subscribe to the Changed event of this image
               
               img.addEventListener("changed", img_Changed);

               // Call a few methods and image processing commands that changes the image
               console.info("Calling FlipViewPerspective");
               img.flipViewPerspective(true);

               console.info("Calling RotateViewPerspective");
               img.rotateViewPerspective(90);

               console.info("Calling FlipCommand");
               var flip = new Leadtools.ImageProcessing.FlipCommand(true);
               flip.run(img);

               // Now disable firing the events and call the methods again
               console.info("Disabling the events");
               img.disableEvents();

               console.info("Calling FlipViewPerspective");
               img.flipViewPerspective(true);

               console.info("Calling RotateViewPerspective");
               img.rotateViewPerspective(90);

               console.info("Calling FlipCommand while");
               flip.run(img);

               // Re-enable the events and fire it manually
               console.info("Re-enabling the events");
               img.enableEvents();

               console.info("Firing the event manually");
               var flags = RasterImageChangedFlags.data | RasterImageChangedFlags.viewPerspective;
               var e = new RasterImageChangedEventArgs(flags);

               img.onChanged(e);

               // Clean up
               img.removeEventListener ( "changed", img_Changed);
               img.close();
               codecs.close();
            },
            function (error) { HandleError(error); });
      }
   }
}

function img_Changed(args)
{
   // Show the changed flags
   console.info("Changed: ", args.flags);
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Dicom;

      
public async Task ChangedExample()
{
   RasterCodecs codecs = new RasterCodecs();
   string srcFileName = @"Assets\Image1.cmp";

   // Load the image
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage img = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   // Subscribe to the Changed event of this image
   img.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);

   // Call a few methods and image processing commands that changes the image
   Debug.WriteLine("Calling FlipViewPerspective");
   img.FlipViewPerspective(true);

   Debug.WriteLine("Calling RotateViewPerspective");
   img.RotateViewPerspective(90);

   Debug.WriteLine("Calling FlipCommand");
   FlipCommand flip = new FlipCommand(true);
   flip.Run(img);

   // Now disable firing the events and call the methods again
   Debug.WriteLine("Disabling the events");
   img.DisableEvents();

   Debug.WriteLine("Calling FlipViewPerspective");
   img.FlipViewPerspective(true);

   Debug.WriteLine("Calling RotateViewPerspective");
   img.RotateViewPerspective(90);

   Debug.WriteLine("Calling FlipCommand while");
   flip.Run(img);

   // Re-enable the events and fire it manually
   Debug.WriteLine("Re-enabling the events");
   img.EnableEvents();

   Debug.WriteLine("Firing the event manually");
   RasterImageChangedFlags flags = RasterImageChangedFlags.Data | RasterImageChangedFlags.ViewPerspective;
   RasterImageChangedEventArgs e = new RasterImageChangedEventArgs(flags);

   img.OnChanged(e);

   // Clean up
   img.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);
   img.Dispose();
   codecs.Dispose();
}

void img_Changed(object sender, RasterImageChangedEventArgs e)
{
   // Show the changed flags
   Debug.WriteLine("Changed: {0}", e.Flags);
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Dicom;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Examples;
using Leadtools.Windows.Media;

public void ChangedExample()
{
   // create a new image to work with
   RasterImage img = new RasterImage(RasterMemoryFlags.Conventional, 500, 500, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, null, 0);
   // Subscribe to the Changed event of this image
   img.Changed += new EventHandler<RasterImageChangedEventArgs>(img_Changed);

   // Call a few methods and image processing commands that changes the image
   Debug.WriteLine("Calling FlipViewPerspective");
   img.FlipViewPerspective(true);

   Debug.WriteLine("Calling RotateViewPerspective");
   img.RotateViewPerspective(90);

   Debug.WriteLine("Calling FlipCommand");
   FlipCommand flip = new FlipCommand(true);
   flip.Run(img);

   // Now disable firing the events and call the methods again
   Debug.WriteLine("Disabling the events");
   img.DisableEvents();

   Debug.WriteLine("Calling FlipViewPerspective");
   img.FlipViewPerspective(true);

   Debug.WriteLine("Calling RotateViewPerspective");
   img.RotateViewPerspective(90);

   Debug.WriteLine("Calling FlipCommand while");
   flip.Run(img);

   // Re-enable the events and fire it manually
   Debug.WriteLine("Re-enabling the events");
   img.EnableEvents();

   Debug.WriteLine("Firing the event manually");
   RasterImageChangedFlags flags = RasterImageChangedFlags.Data | RasterImageChangedFlags.ViewPerspective;
   RasterImageChangedEventArgs e = new RasterImageChangedEventArgs(flags);

   img.OnChanged(e);

   // Clean up
   img.Changed -= new EventHandler<RasterImageChangedEventArgs>(img_Changed);
   img.Dispose();
}

void img_Changed(object sender, RasterImageChangedEventArgs e)
{
   // Show the changed flags
   Debug.WriteLine("Changed: {0}", e.Flags);
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Dicom
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Core
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Windows.Media

Public Sub ChangedExample()
   ' create a new image to work with
   Dim img As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 500, 500, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)
   ' Subscribe to the Changed event of this image
   AddHandler img.Changed, AddressOf img_Changed

   ' Call a few methods and image processing commands that changes the image
   Debug.WriteLine("Calling FlipViewPerspective")
   img.FlipViewPerspective(True)

   Debug.WriteLine("Calling RotateViewPerspective")
   img.RotateViewPerspective(90)

   Debug.WriteLine("Calling FlipCommand")
   Dim flip As FlipCommand = New FlipCommand(True)
   flip.Run(img)

   ' Now disable firing the events and call the methods again
   Debug.WriteLine("Disabling the events")
   img.DisableEvents()

   Debug.WriteLine("Calling FlipViewPerspective")
   img.FlipViewPerspective(True)

   Debug.WriteLine("Calling RotateViewPerspective")
   img.RotateViewPerspective(90)

   Debug.WriteLine("Calling FlipCommand while")
   flip.Run(img)

   ' Re-enable the events and fire it manually
   Debug.WriteLine("Re-enabling the events")
   img.EnableEvents()

   Debug.WriteLine("Firing the event manually")
   Dim flags As RasterImageChangedFlags = RasterImageChangedFlags.Data Or RasterImageChangedFlags.ViewPerspective
   Dim e As RasterImageChangedEventArgs = New RasterImageChangedEventArgs(flags)

   img.OnChanged(e)

   ' Clean up
   RemoveHandler img.Changed, AddressOf img_Changed
   img.Dispose()
End Sub

Private Sub img_Changed(ByVal sender As Object, ByVal e As RasterImageChangedEventArgs)
   ' Show the changed flags
   Debug.WriteLine("Changed: {0}", e.Flags)
End Sub
必要条件

ターゲットプラットホーム

参照

参照

RasterImageクラス
RasterImageメンバ