1 /* 2 */ 3 4 /* 5 6 Copyright (C) 2014 Ferrero Andrea 7 8 This program is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 21 22 */ 23 24 /* 25 26 These files are distributed with PhotoFlow - http://aferrero2707.github.io/PhotoFlow/ 27 28 */ 29 30 #ifndef PF_TYPES_H 31 #define PF_TYPES_H 32 33 #include <lcms2.h> 34 #include <vips/vips.h> 35 36 #include "property.hh" 37 38 typedef cmsInt8Number int8_t; 39 typedef cmsUInt8Number uint8_t; 40 41 typedef cmsInt16Number int16_t; 42 typedef cmsUInt16Number uint16_t; 43 44 typedef cmsInt32Number int32_t; 45 typedef cmsUInt32Number uint32_t; 46 47 // 64-bit base types 48 #if !defined(__APPLE__) && !defined(__MACH__) 49 #ifndef CMS_DONT_USE_INT64 50 typedef cmsInt64Number int64_t; 51 typedef cmsUInt64Number uint64_t; 52 #endif 53 #endif 54 55 typedef cmsFloat32Number float32_t; 56 typedef cmsFloat64Number float64_t; 57 58 #if defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) 59 // Work arround to fix build issues that may occur with Mingw: 60 // error: 'DBL_EPSILON' was not declared in this scope 61 // error: 'FLT_EPSILON' was not declared in this scope 62 63 # ifndef LDBL_EPSILON 64 # define LDBL_EPSILON __LDBL_EPSILON__ 65 # endif 66 # ifndef DBL_EPSILON 67 # define DBL_EPSILON __DBL_EPSILON__ 68 # endif 69 # ifndef FLT_EPSILON 70 # define FLT_EPSILON __FLT_EPSILON__ 71 # endif 72 #endif 73 74 75 76 namespace PF 77 { 78 79 enum BandFormat { 80 PF_BANDFMT_UCHAR = VIPS_FORMAT_UCHAR, 81 PF_BANDFMT_CHAR = VIPS_FORMAT_CHAR, 82 PF_BANDFMT_USHORT = VIPS_FORMAT_USHORT, 83 PF_BANDFMT_SHORT = VIPS_FORMAT_SHORT, 84 PF_BANDFMT_UINT = VIPS_FORMAT_UINT, 85 PF_BANDFMT_INT = VIPS_FORMAT_INT, 86 PF_BANDFMT_FLOAT = VIPS_FORMAT_FLOAT, 87 PF_BANDFMT_DOUBLE = VIPS_FORMAT_DOUBLE, 88 PF_BANDFMT_UNKNOWN 89 }; 90 91 enum colorspace_t { 92 PF_COLORSPACE_RAW, 93 PF_COLORSPACE_GRAYSCALE, 94 PF_COLORSPACE_RGB, 95 PF_COLORSPACE_LAB, 96 PF_COLORSPACE_CMYK, 97 PF_COLORSPACE_MULTIBAND, 98 PF_COLORSPACE_UNKNOWN 99 }; 100 101 template<colorspace_t CS> 102 struct ColorspaceInfo 103 { 104 static int NCH; 105 }; 106 107 enum blendmode_t { 108 PF_BLEND_PASSTHROUGH, 109 PF_BLEND_NORMAL, 110 PF_BLEND_LUMINANCE, 111 PF_BLEND_COLOR, 112 PF_BLEND_LCH_L, 113 PF_BLEND_LCH_C, 114 PF_BLEND_LCH_H, 115 PF_BLEND_ADD, 116 PF_BLEND_SUBTRACT, 117 PF_BLEND_MULTIPLY, 118 PF_BLEND_DIVIDE, 119 PF_BLEND_GRAIN_EXTRACT, 120 PF_BLEND_GRAIN_MERGE, 121 PF_BLEND_OVERLAY, 122 PF_BLEND_OVERLAY_GIMP, 123 PF_BLEND_SOFT_LIGHT, 124 PF_BLEND_HARD_LIGHT, 125 PF_BLEND_VIVID_LIGHT, 126 PF_BLEND_SCREEN, 127 PF_BLEND_LIGHTEN, 128 PF_BLEND_DARKEN, 129 PF_BLEND_LUMI, 130 PF_BLEND_SEP1=1001, 131 PF_BLEND_SEP2=1002, 132 PF_BLEND_SEP3=1003, 133 PF_BLEND_SEP4=1004, 134 PF_BLEND_SEP5=1005, 135 PF_BLEND_SEP6=1006, 136 PF_BLEND_SEP7=1007, 137 PF_BLEND_SEP8=1008, 138 PF_BLEND_SEP9=1009, 139 PF_BLEND_LAST 140 }; 141 142 enum mask_blendmode_t { 143 PF_MASK_BLEND_NORMAL = PF_BLEND_NORMAL, 144 PF_MASK_BLEND_MULTIPLY = PF_BLEND_MULTIPLY, 145 PF_MASK_BLEND_INTERSECTION = PF_BLEND_LAST+1, 146 PF_MASK_BLEND_UNION, 147 PF_MASK_BLEND_EXCLUSION, 148 PF_MASK_BLEND_UNKNOWN 149 }; 150 151 enum rendermode_t { 152 PF_RENDER_NORMAL, 153 PF_RENDER_PREVIEW, 154 PF_RENDER_EDITING 155 }; 156 157 158 colorspace_t convert_colorspace(VipsInterpretation interpretation); 159 160 161 enum mod_key_t { 162 MOD_KEY_NONE = 0, 163 MOD_KEY_CTRL = 1, 164 MOD_KEY_ALT = 2, 165 MOD_KEY_SHIFT = 4 166 }; 167 168 169 enum wb_mode_t { 170 WB_CAMERA=0, 171 WB_SPOT=1, 172 WB_COLOR_SPOT=2, 173 WB_AREA_SPOT=3, 174 WB_UNIWB=4, 175 WB_DAYLIGHT, 176 WB_DIRECT_SUNLIGHT, 177 WB_CLOUDY, 178 WB_SHADE, 179 WB_INCANDESCENT, 180 WB_INCANDESCENT_WARM, 181 WB_TUNGSTEN, 182 WB_FLUORESCENT, 183 WB_FLUORESCENT_HIGH, 184 WB_COOL_WHITE_FLUORESCENT, 185 WB_WARM_WHITE_FLUORESCENT, 186 WB_DAYLIGHT_FLUORESCENT, 187 WB_NEUTRAL_FLUORESCENT, 188 WB_WHITE_FLUORESCENT, 189 WB_SODIUM_VAPOR_FLUORESCENT, 190 WB_DAY_WHITE_FLUORESCENT, 191 WB_HIGH_TEMP_MERCURY_VAPOR_FLUORESCENT, 192 WB_FLASH, 193 WB_FLASH_AUTO, 194 WB_EVENING_SUN, 195 WB_UNDERWATER, 196 WB_BACK_AND_WHITE, 197 WB_LAST 198 }; 199 200 201 enum hlreco_mode_t { 202 HLRECO_NONE, 203 HLRECO_CLIP, 204 HLRECO_BLEND 205 }; 206 207 208 enum jpeg_quant_table_t { 209 JPEG_QUANT_TABLE_DEFAULT = 0, 210 JPEG_QUANT_TABLE_MEDIUM = 2, 211 JPEG_QUANT_TABLE_BEST = 4 212 }; 213 214 215 enum export_size_t { 216 SIZE_ORIGINAL, 217 SIZE_400_300, 218 SIZE_800_600, 219 SIZE_1280_720, 220 SIZE_1280_800, 221 SIZE_1280_1024, 222 SIZE_1440_900, 223 SIZE_1600_1200, 224 SIZE_1920_1080, 225 SIZE_1920_1200, 226 SIZE_2048_1400, 227 SIZE_2048_2048, 228 SIZE_2K, 229 SIZE_4K, 230 SIZE_5K, 231 SIZE_8K, 232 SIZE_A4_300DPI, 233 SIZE_A4P_300DPI, 234 SIZE_CUSTOM 235 }; 236 237 238 239 enum scale_mode_t 240 { 241 SCALE_MODE_FIT, 242 SCALE_MODE_FILL, 243 SCALE_MODE_RESIZE 244 }; 245 246 247 enum scale_unit_t 248 { 249 SCALE_UNIT_PX, 250 SCALE_UNIT_PERCENT, 251 SCALE_UNIT_MM, 252 SCALE_UNIT_CM, 253 SCALE_UNIT_INCHES 254 }; 255 256 257 enum scale_interpolation_t 258 { 259 SCALE_INTERP_NEAREST, 260 SCALE_INTERP_BILINEAR, 261 SCALE_INTERP_BICUBIC, 262 SCALE_INTERP_LANCZOS2, 263 SCALE_INTERP_LANCZOS3, 264 SCALE_INTERP_NOHALO 265 }; 266 267 268 269 template<> 270 class Property<blendmode_t>: public PropertyBase 271 { 272 public: 273 Property(std::string name, OpParBase* par); 274 }; 275 276 277 template<> 278 class Property<mask_blendmode_t>: public PropertyBase 279 { 280 public: 281 Property(std::string name, OpParBase* par); 282 }; 283 284 285 } 286 287 #endif 288