1 /* LiquidRescaling Library
2 * Copyright (C) 2007-2009 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
5 * This library implements the algorithm described in the paper
6 * "Seam Carving for Content-Aware Image Resizing"
7 * by Shai Avidan and Ariel Shamir
8 * which can be found at http://www.faculty.idc.ac.il/arik/imret.pdf
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; version 3 dated June, 2007.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>
27 #include <lqr/lqr_base.h>
28 #include <lqr/lqr_progress.h>
32 lqr_progress_new(void)
34 LqrProgress
* progress
;
35 TRY_N_N(progress
= g_try_new0(LqrProgress
, 1));
37 lqr_progress_set_init_width_message(progress
, "Resizing width...");
38 lqr_progress_set_init_height_message(progress
, "Resizing height...");
39 lqr_progress_set_end_width_message(progress
, "done");
40 lqr_progress_set_end_height_message(progress
, "done");
41 lqr_progress_set_update_step(progress
, 0.02);
47 lqr_progress_init(LqrProgress
* p
, const gchar
* message
)
52 return p
->init(message
);
61 lqr_progress_update(LqrProgress
* p
, gdouble percentage
)
66 return p
->update(percentage
);
75 lqr_progress_end(LqrProgress
* p
, const gchar
* message
)
80 return p
->end(message
);
90 lqr_progress_set_init(LqrProgress
* p
, LqrProgressFuncInit init_func
)
98 lqr_progress_set_update(LqrProgress
* p
, LqrProgressFuncUpdate update_func
)
100 p
->update
= update_func
;
106 lqr_progress_set_end(LqrProgress
* p
, LqrProgressFuncEnd end_func
)
114 lqr_progress_set_update_step (LqrProgress
*p
, gfloat update_step
)
116 p
->update_step
= update_step
;
122 lqr_progress_set_init_width_message(LqrProgress
*p
, const gchar
* message
)
125 strncpy(p
->init_width_message
, message
, LQR_PROGRESS_MAX_MESSAGE_LENGTH
);
131 lqr_progress_set_init_height_message(LqrProgress
*p
, const gchar
* message
)
134 strncpy(p
->init_height_message
, message
, LQR_PROGRESS_MAX_MESSAGE_LENGTH
);
140 lqr_progress_set_end_width_message(LqrProgress
*p
, const gchar
* message
)
143 strncpy(p
->end_width_message
, message
, LQR_PROGRESS_MAX_MESSAGE_LENGTH
);
149 lqr_progress_set_end_height_message(LqrProgress
*p
, const gchar
* message
)
152 strncpy(p
->end_height_message
, message
, LQR_PROGRESS_MAX_MESSAGE_LENGTH
);