←Select platform

Tile Property

Summary
Gets the rectangular area of the image being loaded.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public LeadRect Tile { get; } 
@property (nonatomic, assign, readonly) LeadRect tile; 
public LeadRect getTile() 
public: 
property LeadRect Tile { 
   LeadRect get(); 
} 

Property Value

The rectangular area of the image being loaded. The default value is 0,0,0,0.

Remarks

This is only valid if OffsetValid is true.

This is the same value passed to the Load or LoadAsync methods that take a tile parameter.

.

Example
C#
Java
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. 
   Debug.WriteLine("File name is: {0}", e.FileName); 
   Debug.WriteLine("The Image width and height is: {0},{1}", e.Image.Width, e.Image.Height); 
   Debug.WriteLine("The Length of the buffer is: {0}", e.Buffer.Length); 
   Debug.WriteLine("The current row in the first line of the buffer is: {0}", e.Row); 
   Debug.WriteLine("The number of lines in the buffer is: {0}", e.Lines); 
 
   if (e.OffsetValid) 
   { 
      Debug.WriteLine("Offset count is : {0}", e.OffsetCount); 
      Debug.WriteLine("Offset value is : {0}", e.Offset); 
   } 
 
   if (e.TileValid) 
   { 
      LeadRect rect = e.Tile; 
      Debug.WriteLine("Tile Dimension ({0},{1},{2},{3)}", rect.X, rect.Y, rect.Width, rect.Height); 
   } 
 
   Debug.WriteLine("Image p number: {0}", e.ImagePage); 
   Debug.WriteLine("First page number: {0}", e.FirstPage); 
   Debug.WriteLine("Current page number: {0}", e.Page); 
   Debug.WriteLine("Last page number: {0}", e.LastPage); 
   Debug.WriteLine("Page percent: {0}%", e.PagePercent); 
   Debug.WriteLine("Total percent: {0}%", e.TotalPercent); 
   Debug.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:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.*; 
import java.net.*; 
import java.nio.file.Paths; 
import java.util.*; 
import java.time.Instant; 
import java.time.Duration; 
 
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.codecs.RasterCodecs.FeedCallbackThunk; 
import leadtools.drawing.internal.*; 
import leadtools.imageprocessing.*; 
import leadtools.imageprocessing.color.ChangeIntensityCommand; 
import leadtools.svg.*; 
 
 
CodecsLoadImageListener codecsLoadImage = new CodecsLoadImageListener() { 
 
   @Override 
   public void onLoadImage(CodecsLoadImageEvent e) { 
      e.setCancel(true); 
 
      // get all properties for the CodecsLoadImageEventArgs class. 
      System.out.println("File name is: " + e.getFileName()); 
      System.out 
            .println("The Image width and height is: " + e.getImage().getWidth() + "," + e.getImage().getHeight()); 
      System.out.println("The Length of the buffer is: " + e.getBuffer().getLength()); 
      System.out.println("The current row in the first line of the buffer is: " + e.getRow()); 
      System.out.println("The number of lines in the buffer is: " + e.getLines()); 
 
      if (e.getTileValid()) { 
         LeadRect rect = e.getTile(); 
         System.out.println("Tile Dimension (" + rect.getX() + "," + rect.getY() + "," + rect.getWidth() + "," 
               + rect.getHeight() + ")"); 
      } 
 
      System.out.println("Image p number: " + e.getImagePage()); 
      System.out.println("First page number: " + e.getFirstPage()); 
      System.out.println("Current page number: " + e.getPage()); 
      System.out.println("Last page number: " + e.getLastPage()); 
      System.out.println("Page percent: " + e.getPagePercent()); 
      System.out.println("Total percent: " + e.getTotalPercent()); 
      System.out.println("Flags = " + e.getFlags()); 
 
      e.getStream(); 
      e.getInfo(); 
      e.setCancel(false); 
   } 
}; 
 
public void loadImageExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.addLoadImageListener(codecsLoadImage); 
   RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Image1.cmp")); 
   codecs.removeLoadImageListener(codecsLoadImage); 
 
   // Clean up 
   codecs.dispose(); 
   image.dispose(); 
} 
Requirements

Target Platforms

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

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.