1 /* LiquidRescaling Library DEMO program
2 * Copyright (C) 2007-2009 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3 dated June, 2007.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>
18 #ifndef __LIQUIDRESCALE_H__
19 #define __LIQUIDRESCALE_H__
21 /*** SIGNAL HANDLING MACROS ***/
24 #define CHECK_OR_N(expr, mess) G_STMT_START{ \
26 cerr << "Error: " << mess << endl; \
31 #define TRAP_N(expr) G_STMT_START{ \
32 if ((expr) == NULL) { \
33 cerr << "Error: not enough memory, aborting" << endl; \
38 #define TRAP(expr) G_STMT_START{ \
42 cerr << "Fatal error, aborting." << endl; \
46 cerr << "Not enough memory, aborting." << endl; \
50 cerr << "Cancelled by user, aborting." << endl; \
58 /*** PARSE COMMAND LINE ***/
59 LqrRetVal
parse_command_line(int argc
, char **argv
);
60 void help(char *command
);
62 /*** RGB FILE I/O ***/
63 guchar
*rgb_buffer_from_image(pngwriter
*png
);
64 LqrRetVal
write_carver_to_image(LqrCarver
*r
, pngwriter
*png
);
66 /*** VMAP FILES I/O ***/
67 LqrRetVal
save_vmap_to_file(LqrVMap
*vmap
, gchar
*name
);
68 LqrVMap
*load_vmap_from_file(gchar
*name
);
70 /*** ENERGY FUNCTIONS ***/
71 gfloat
sobelx(gint x
, gint y
, gint w
, gint h
, LqrReadingWindow
*rw
, gpointer extra_data
);
72 gfloat
sobel(gint x
, gint y
, gint w
, gint h
, LqrReadingWindow
*rw
, gpointer extra_data
);
73 LqrRetVal
set_energy(LqrCarver
*carver
, gchar
*energy_function
);
74 LqrRetVal
write_energy(LqrCarver
*carver
, gchar
*energy_outfile
, gint orientation
);
76 /*** PROGRESS REPORT FUNCTIONS ***/
77 LqrRetVal
my_progress_init(const gchar
*message
);
78 LqrRetVal
my_progress_update(gdouble percentage
);
79 LqrRetVal
my_progress_end(const gchar
*message
);
80 void init_progress(LqrProgress
* progress
);
83 void info_msg(const gchar
*msg
, const gchar
*name
);
84 gpointer
cancel_thread(gpointer data
);
85 void cancel_handler(int signum
);
87 #endif /* __LIQUIDRESCALE_H__ */