Chapter 2. LqR library API user manual

Table of Contents

Signal handling
Generating the multi-size image
Carver object creation
Carver activation
Choosing the image type
Liquid rescaling
The resizing method
Flattening
Cancelling an action
Reading the multi-size image
Pixel by pixel
One line at a time
Resetting
Automatic feature detection
Foreword
Builtin energy functions
Custom energy functions
Reading out the energy
Adding a bias
Foreword
Adding a bias pixel by pixel
Using an array of floating-point values
Using another image
Operating on a specific area
Adding a rigidity mask
Foreword
Adding an individual rigidity coefficient to a pixel
Using an array of floating-point values
Using another image
Operating on a specific area
Tuning
Setting the enlargement step
Choosing the resize order
Choosing the side switch frequency
Using the cache
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
Initial and ending progress 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

LQR_USRCANCEL

action cancelled by the user

At top level, it is important that the user handle these values explicitly, because the library functions don'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:

LQR_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)

LQR_CATCH_F (expr)

returns LQR_ERROR if expr is FALSE

LQR_CATCH_MEM (expr)

returns LQR_NOMEM if expr is NULL

Note

The names of these macros have changed since version 0.4; the previous names CATCH, CATCH_F and CATCH_MEM are still available, but they can be disabled at configure time if they cause conflicts (configure --help for details).