By default, the resizing performed silently. However,
it is possible to define progress report functions, to receive
feedback while the resizing is in progress.
This is done through the LqrProgress
objects.
A LqrProgress
object
is created through the function:
LqrProgress* lqr_progress_new( | void) ; |
and can be associated to a LqrCarver
object through this function:
void lqr_carver_set_progress( | LqrCarver* | carver, |
LqrProgress* | p) ; |
Newly created progress objects are inactive, and need to be set up.
First, hook functions have to be set, which specify the action to take as the rescaling process starts, progresses, and ends, by using the functions:
LqrRetVallqr_progress_set_init
(LqrProgress
*p
, LqrProgressFuncInitinit_func
) LqrRetVallqr_progress_set_update
(LqrProgress
*p
, LqrProgressFuncUpdateupdate_func
) LqrRetVallqr_progress_set_end
(LqrProgress
*p
, LqrProgressFuncEndend_func
)
as in this sample piece of code:
Example 2.8. Setting progress hooks
LqrProgress *p; p = lqr_progress_new(); lqr_progress_set_init (p, my_init); lqr_progress_set_update (p, my_update); lqr_progress_set_end (p, my_end);
The above example requires that the hook functions
my_init
, my_update
and
my_end
are defined as in the following sample declarations:
Example 2.9. Progress hooks declaration
LqrRetVal my_init (const gchar *init_message); LqrRetVal my_update (gdouble percentage); LqrRetVal my_end (const gchar *end_message);
The init and end messages that will be passed to the hooks will change, depending if the resizing is occurring in the horizontal or in the vertical direction. The defaults are:
Table 2.1. Default progress messages
init | end | |
---|---|---|
width | "Resizing width..." | "done" |
height | "Resizing height..." | "done" |
These can be changed with these functions:
LqrRetVallqr_progress_set_init_width_message
(LqrProgress
*p
, const gchar *message
) LqrRetVallqr_progress_set_init_height_message
(LqrProgress
*p
, const gchar *message
) LqrRetVallqr_progress_set_end_width_message
(LqrProgress
*p
, const gchar *message
) LqrRetVallqr_progress_set_end_height_message
(LqrProgress
*p
, const gchar *message
)