| 1 |
/* LiquidRescaling Library EXAMPLE program |
| 2 |
* Copyright (C) 2007-2009 Carlo Baldassi (the "Author") <[email protected]>. |
| 3 |
* All Rights Reserved. |
| 4 |
* |
| 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. |
| 8 |
|
| 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. |
| 13 |
|
| 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/> |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef __LIQUIDRESCALE_BASIC_H__ |
| 19 |
#define __LIQUIDRESCALE_BASIC_H__ |
| 20 |
|
| 21 |
/*** SIGNAL HANDLING MACROS ***/ |
| 22 |
|
| 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 |
| 30 |
|
| 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 |
| 37 |
|
| 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 |
| 57 |
|
| 58 |
/*** PARSE COMMAND LINE ***/ |
| 59 |
LqrRetVal parse_command_line(int argc, char **argv); |
| 60 |
void help(char *command); |
| 61 |
|
| 62 |
/*** RGB FILE I/O ***/ |
| 63 |
guchar *rgb_buffer_from_image(pngwriter *png); |
| 64 |
LqrRetVal write_carver_to_image(LqrCarver *r, pngwriter *png); |
| 65 |
|
| 66 |
#endif /* __LIQUIDRESCALE_BASIC_H__ */ |