←Select platform

Data Property

Summary
Gets the unmanaged buffer containing one or more lines of output image data that the command has already converted.
Syntax
C#
C++/CLI
Java
Python
public IntPtr Data { get; } 
public byte[] getData() 
public: 
property IntPtr Data { 
   IntPtr get(); 
} 

Property Value

The buffer containing one or more lines of output image data that the command has already converted.

Remarks

This property returns the data in an unmanaged buffer. You can use the Marshal.Copy method to copy this data to a managed buffer.

To get the data in a managed array, use the DataArray property.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
 
 
public void ColorResolutionCommandDataEventArgsExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
	string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_colorresData.bmp"); 
 
	// Load the source image from disk 
	RasterImage srcImage = codecs.Load(srcFileName); 
 
	// Create the destination image 
	_row = 0; 
	_destImage = new RasterImage( 
	   RasterMemoryFlags.Conventional, 
	   srcImage.Width, 
	   srcImage.Height, 
	   1, 
	   RasterByteOrder.Rgb, 
	   RasterViewPerspective.TopLeft, 
	   null, 
	   IntPtr.Zero, 
	   0); 
 
	// Color-res the image to 1 bits/pixel, we will save the data ourselves into 
	// the destination image 
	ColorResolutionCommand command = new ColorResolutionCommand(); 
	command.BitsPerPixel = 1; 
	command.DitheringMethod = RasterDitheringMethod.FloydStein; 
	command.Data += new EventHandler<ColorResolutionCommandDataEventArgs>(command_Data); 
	_destImage.Access(); 
	command.Run(srcImage); 
	_destImage.Release(); 
	command.Data -= new EventHandler<ColorResolutionCommandDataEventArgs>(command_Data); 
 
	// Save it to disk 
	codecs.Save(_destImage, destFileName, RasterImageFormat.Bmp, 4); 
 
	// Clean Up 
	_destImage.Dispose(); 
	srcImage.Dispose(); 
	codecs.Dispose(); 
} 
 
RasterImage _destImage; 
int _row; 
 
void command_Data(object sender, ColorResolutionCommandDataEventArgs e) 
{ 
	// Set the data into the destination image 
	_destImage.SetRow(_row, e.Data, _destImage.BytesPerLine * e.Lines); 
	_row += e.Lines; 
 
	// If you want the data in a managed buffer, 
	// you can do this 
	// byte[] data = new byte[_destImage.BytesPerLine * e.Lines]; 
	// System.Runtime.InteropServices.Marshal.Copy(e.Data, data, 0, data.Length); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools Assembly

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