Chapter 2. API user manual

Table of Contents

Signal handling
Generating the multi-size image
Carver object creation
Carver activation
Liquid rescaling
The resizing method
Flattening
Reading the multi-size image
Pixel by pixel
One line at a time
Resetting
Adding a bias
Foreword
Using an array of floating-point values
Using another image
Operating on a specific area
Tuning
Choosing a gradient function
Choosing the resize order
Dealing with the visibility maps (the seams)
Dumping the visibility map
Storing the visibility maps
Accessing the internally attached visibility maps
The visibility map objects
Importing a visibility map in a carver
Saving and loading visibility maps to/from files
Attaching extra images
Attaching a carver
Accessing attached carvers
Progress indicators
Creating and attaching a progress report object
Setting up progress hooks
Progress report messages
Progress update step
Releasing the memory

Signal handling

Many library functions return a value of type LqrRetVal. This is an enum type which can hold the values:

LQR_OK

everyting OK

LQR_ERROR

generic fatal error

LQR_NOMEM

not enough memory

At top level, the user should handle this values explicitely, because the library doesn't do anything else than stopping and returning an error signal in case of errors. An easy way is setting up some macros and wrap each function call with those, as shown in the example files.

Below top level, the library provides some convenient macros which can be used to wrap function calls, in order to propagate these signals:

CATCH (expr)

if expr is equal to LQR_OK it does nothing, otherwise it returns expr (or the result of the execution of expr if it happens to be a function)

CATCH_F (expr)

returns LQR_ERROR if expr is FALSE

CATCH_MEM (expr)

returns LQR_NOMEM if expr is NULL