←Select platform

LoadImage Event

Summary
Occurs during the file load process to provide functionality for manually handling the output image data or monitoring a progress status.
Syntax
C#
VB
C++
Java
public event EventHandler<CodecsLoadImageEventArgs> LoadImage 
Public Event LoadImage As EventHandler(Of CodecsLoadImageEventArgs) 
synchronized public void addLoadImageListener(CodecsLoadImageListener listener) 
synchronized public void removeLoadImageListener(CodecsLoadImageListener listener) 
public: 
event EventHandler<CodecsLoadImageEventArgs^>^ LoadImage 
Event Data

The event handler receives an argument of type CodecsLoadImageEventArgs containing data related to this event. The following CodecsLoadImageEventArgs properties provide information specific to this event.

PropertyDescription
Buffer Gets the memory buffer containing one or more lines of output image data.
Remarks

This event will fire during loading images with the Load and LoadAsync methods. You can use this event to get information about the image being loaded, manually handle the image scanline data or provide a progress status as well as to abort the load operation.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
private void Codecs_LoadImage(object sender, CodecsLoadImageEventArgs e) 
{ 
	e.Cancel = true; 
 
	// get all properties for the CodecsLoadImageEventArgs class. 
	Console.WriteLine("File name is: {0}", e.FileName); 
	Console.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height); 
	Console.WriteLine("The Length of the buffer is: {0}", e.Buffer.Length); 
	Console.WriteLine("The current row in the first line of the buffer is: {0}", e.Row); 
 
	if (e.OffsetValid) 
	{ 
		Console.WriteLine("Offset count is : {0}", e.OffsetCount); 
		Console.WriteLine("Offset value is : {0}", e.Offset); 
	} 
 
	if (e.TileValid) 
	{ 
		LeadRect rect = e.Tile; 
		Console.WriteLine("Tile Dimension ({0},{1},{2},{3)}", rect.X, rect.Y, rect.Width, rect.Height); 
	} 
 
	Console.WriteLine("Image p number: {0}", e.ImagePage); 
	Console.WriteLine("First page number: {0}", e.FirstPage); 
	Console.WriteLine("Current page number: {0}", e.Page); 
	Console.WriteLine("Last page number: {0}", e.LastPage); 
	Console.WriteLine("Page percent: {0}%", e.PagePercent); 
	Console.WriteLine("Total percent: {0}%", e.TotalPercent); 
	Console.WriteLine("Flags = {0}", e.Flags); 
 
	System.IO.Stream loadStream = e.Stream; 
	CodecsImageInfo info = e.Info; 
	e.Cancel = false; 
} 
 
		public void LoadImageExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	codecs.LoadImage += new EventHandler<CodecsLoadImageEventArgs>(Codecs_LoadImage); 
	RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")); 
	codecs.LoadImage -= new EventHandler<CodecsLoadImageEventArgs>(Codecs_LoadImage); 
 
	// Clean up 
	codecs.Dispose(); 
	image.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 21.0.2021.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly