Using Callback Functions

A callback function is a function that you write and that LEADTOOLS calls. With a callback function you can add processing, and in some cases, you can direct the input or output of a LEADTOOLS engine such as the decompression engine. Generally, the engine is in a loop. In cases where you can direct the output, with each time through the loop, it fills a buffer with data and calls your function to process the data.

Callback functions are also commonly used to update status bars or to see if the user wants to interrupt the process. The L_SetStatusCallBack function enables you to do that with many functions that do not declare a callback in the parameter list.

To retrieve the current status callback function, and any associated user-defined data, call L_GetStatusCallBack.

In addition, many of the LEADTOOLS functions let you pass a parameter that specifies a callback function. These callback functions are more flexible than the one specified with L_SetStatusCallBack. There are some variations in how the idea is implemented, and you must refer to the individual function descriptions to see how they are used.

LEADTOOLS C API callback functions let you perform the following:

File-to-buffer compression and decompression

File-to-buffer image loading

Redirected I/O functions for memory-to-memory compression and decompression

On-the-fly resizing

Painting while loading

Seeing if the user wants to interrupt the process

Updating a status bar

Providing help for dialogs

For a list of the possible callback functions, refer to Callbacks.

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

LEADTOOLS Raster Imaging C API Help