Removed inlines
[liblqr.git] / examples / liquidrescale.h
blob1f3b88df0b0584db3257b99d1c9476a60e120700
1 /* LiquidRescaling Library DEMO program
2 * Copyright (C) 2007-2009 Carlo Baldassi (the "Author") <carlobaldassi@gmail.com>.
3 * All Rights Reserved.
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 ***/
23 #define RBS (1000)
24 #define CHECK_OR_N(expr, mess) G_STMT_START{ \
25 if (!(expr)) { \
26 cerr << "Error: " << mess << endl; \
27 return NULL; \
28 } \
29 }G_STMT_END
31 #define TRAP_N(expr) G_STMT_START{ \
32 if ((expr) == NULL) { \
33 cerr << "Error: not enough memory, aborting" << endl; \
34 exit(1); \
35 } \
36 }G_STMT_END
38 #define TRAP(expr) G_STMT_START{ \
39 switch (expr) \
40 { \
41 case LQR_ERROR: \
42 cerr << "Fatal error, aborting." << endl; \
43 exit (1); \
44 break; \
45 case LQR_NOMEM: \
46 cerr << "Not enough memory, aborting." << endl; \
47 exit (1); \
48 break; \
49 case LQR_USRCANCEL: \
50 cerr << "Cancelled by user, aborting." << endl; \
51 exit (1); \
52 break; \
53 default: \
54 break; \
55 } \
56 }G_STMT_END
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);
82 /*** EXTRA ***/
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__ */