←Select platform

SetRasterImageAllocateCallback Method

Summary
Sets a global callback to be called whenever the toolkit is creating a new RasterImage object.
Syntax
C#
C++/CLI
Python
public static RasterImageAllocateCallback SetRasterImageAllocateCallback( 
   RasterImageAllocateCallback callback 
) 
public: 
static RasterImageAllocateCallback^ SetRasterImageAllocateCallback(  
   RasterImageAllocateCallback^ callback 
)  
def SetRasterImageAllocateCallback(self,callback): 

Parameters

callback
Method to be called whenever the toolkit is creating a new RasterImage object. You can pass null to stop the toolkit from calling any callback.

Return Value

The previous global callback set, or null if no callback was set before (default).

Remarks

This method allows you to inspect (and change the memory model being used) whenever the toolkit is creating a new RasterImage object. Generally, you can use the RasterMemoryFlags argument to the RasterImage constructor when creating new objects, however, in some instances, the toolkit will create images internally and you have no control on the memory model being passed. The callback set is global to all LEADTOOLS used in current process.

This can be useful for debugging purposes or to control the memory model of an image being creating internally in LEADTOOLS, for example, as a result of an image processing operation as described in the example.

The return value is the old callback set previously by the user, if no callback was set previously, this method will return null, this allow you to cascade callbacks together.

By default, the toolkit does not set a callback, and calling this method the first time will always return null.

When you are done when the callback, you can call this method with a null reference to stop the toolkit from calling any methods when creating RasterImage objects.

Example

The following example will show how to use the SetRasterImageAllocateCallback method to stop LEADTOOLS from creating any disk images whatever. The RotateCommand used in the example will internally create a new RasterImage object. By default, the user has no control on the memory model for this image, however, by using this callback, the user can control (and change) the memory model used.

 

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 Assembly

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