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/>
23 #ifndef __LQR_BASE_H__
24 #define __LQR_BASE_H__
26 #define LQR_MAX_NAME_LENGTH (1024)
28 #if defined(G_OS_WIN32) && ! defined(LQR_DISABLE_DECLSPEC)
30 # define LQR_PUBLIC __declspec(dllexport)
32 # define LQR_PUBLIC __declspec(dllimport)
33 # endif /* LQR_EXPORTS */
34 #elif defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
35 # ifndef GCC_HASCLASSVISIBILITY
36 # define GCC_HASCLASSVISIBILITY
37 # endif /* !GCC_HASCLASSVISIBILITY */
38 # ifdef GCC_HASCLASSVISIBILITY
39 # define LQR_PUBLIC __attribute__((visibility("default")))
42 # endif /* GCC_HASCLASSVISIBILITY */
45 #endif /* G_OS_WIN32 */
52 #define __LQR_VERBOSE__
55 /**** RETURN VALUES (signals) ****/
57 LQR_ERROR
, /* generic error */
59 LQR_NOMEM
, /* not enough memory */
60 LQR_USRCANCEL
/* action cancelled by user */
63 typedef enum _LqrRetVal LqrRetVal
;
65 #define LQR_TRY_N_N(assign) if ((assign) == NULL) { return NULL; }
67 #define LQR_TRY_F_N(assign) if ((assign) == FALSE) { return NULL; }
68 #define LQR_TRY_N_F(assign) if ((assign) == NULL) { return FALSE; }
69 #define LQR_TRY_F_F(assign) if ((assign) == FALSE) { return FALSE; }
72 /* generic signal processing macros */
73 #define LQR_CATCH(expr) G_STMT_START { \
75 if ((ret_val = (expr)) != LQR_OK) \
81 /* convert a NULL assignment to an error signal */
82 #define LQR_CATCH_MEM(expr) G_STMT_START { \
89 /* convert a boolean value to an error signal */
90 #define LQR_CATCH_F(expr) G_STMT_START { \
91 if ((expr) == FALSE) \
98 #ifndef LQR_DISABLE_LEGACY_MACROS
99 # define CATCH(expr) LQR_CATCH(expr)
100 # define CATCH_MEM(expr) LQR_CATCH_MEM(expr)
101 # define CATCH_F(expr) LQR_CATCH_F(expr)
102 # define TRY_N_N(expr) LQR_TRY_N_N(expr)
103 #endif /* LQR_DISABLE_LEGACY_MACROS */
105 /**** IMAGE DEPTH ****/
113 typedef enum _LqrColDepth LqrColDepth
;
115 /**** IMAGE BASE TYPES ****/
116 typedef guchar lqr_t_8i
;
117 typedef guint16 lqr_t_16i
;
118 typedef gfloat lqr_t_32f
;
119 typedef gdouble lqr_t_64f
;
121 /**** RESIZE ORDER ****/
122 enum _LqrResizeOrder
{
127 typedef enum _LqrResizeOrder LqrResizeOrder
;
129 /**** IMAGE TYPE ****/
141 typedef enum _LqrImageType LqrImageType
;
143 /**** CLASSES DECLARATIONS ****/
147 typedef struct _LqrCarver LqrCarver
;
149 #endif /* __LQR_BASE_H__ */