Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.3.5
SetUserData Method
See Also 
Leadtools Namespace > RasterImage Class : SetUserData Method




data
Pointer to the unmanaged memory buffer containing the image new data.
size
Number of bytes in data.
Sets the data for the image to the specified unmanaged memory buffer.

Syntax

Visual Basic (Declaration) 
Public Sub SetUserData( _
   ByVal data As IntPtr, _
   ByVal size As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim data As IntPtr
Dim size As Integer
 
instance.SetUserData(data, size)
C# 
public void SetUserData( 
   IntPtr data,
   int size
)
Managed Extensions for C++ 
public: void SetUserData( 
   IntPtr data,
   int size
) 
C++/CLI 
public:
void SetUserData( 
   IntPtr data,
   int size
) 

Parameters

data
Pointer to the unmanaged memory buffer containing the image new data.
size
Number of bytes in data.

Example

This example uses GetPixelData and SetPixelData methods to swap the R and G values for a particular pixel.

Remarks

The data that you specify will not be copied, but instead will be referenced by the image until the image is disposed, or until you call this method again.

To set up a RasterImage object with unmanaged user data, call the _ctor constructor passing RasterMemoryFlags.Userto the flags parameter.

Some image processing commands, such as RotateCommand and ColorResolutionCommand, need to re-allocate the image data. If you create an image with RasterMemoryFlags.User, and pass it to these command, they will change the image to RasterMemoryFlags.Conventional and re-allocate memory. Your original memory will no longer be used.

You are responsible for managing the image data. Dispose will not free data.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also