1 /* Definitions for VIPS colour package. 2 * 3 * J.Cupitt, 8/4/93 4 * 15/7/96 JC 5 * - C++ stuff added 6 * 20/2/98 JC 7 * - new display calibration added 8 * 26/9/05 9 * - added IM_ prefix to colour temps 10 */ 11 12 /* 13 14 This file is part of VIPS. 15 16 VIPS is free software; you can redistribute it and/or modify 17 it under the terms of the GNU Lesser General Public License as published by 18 the Free Software Foundation; either version 2 of the License, or 19 (at your option) any later version. 20 21 This program is distributed in the hope that it will be useful, 22 but WITHOUT ANY WARRANTY; without even the implied warranty of 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 GNU Lesser General Public License for more details. 25 26 You should have received a copy of the GNU Lesser General Public License 27 along with this program; if not, write to the Free Software 28 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 29 02110-1301 USA 30 31 */ 32 33 /* 34 35 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 36 37 */ 38 39 #ifndef VIPS_COLOUR_H 40 #define VIPS_COLOUR_H 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif /*__cplusplus*/ 45 46 /* Areas under curves for Dxx. 2 degree observer. 47 */ 48 #define VIPS_D93_X0 (89.7400) 49 #define VIPS_D93_Y0 (100.0) 50 #define VIPS_D93_Z0 (130.7700) 51 52 #define VIPS_D75_X0 (94.9682) 53 #define VIPS_D75_Y0 (100.0) 54 #define VIPS_D75_Z0 (122.5710) 55 56 /* D65 temp 6504. 57 */ 58 #define VIPS_D65_X0 (95.0470) 59 #define VIPS_D65_Y0 (100.0) 60 #define VIPS_D65_Z0 (108.8827) 61 62 #define VIPS_D55_X0 (95.6831) 63 #define VIPS_D55_Y0 (100.0) 64 #define VIPS_D55_Z0 (92.0871) 65 66 #define VIPS_D50_X0 (96.4250) 67 #define VIPS_D50_Y0 (100.0) 68 #define VIPS_D50_Z0 (82.4680) 69 70 /* A temp 2856k. 71 */ 72 #define VIPS_A_X0 (109.8503) 73 #define VIPS_A_Y0 (100.0) 74 #define VIPS_A_Z0 (35.5849) 75 76 /* B temp 4874k. 77 */ 78 #define VIPS_B_X0 (99.0720) 79 #define VIPS_B_Y0 (100.0) 80 #define VIPS_B_Z0 (85.2230) 81 82 /* C temp 6774k. 83 */ 84 #define VIPS_C_X0 (98.0700) 85 #define VIPS_C_Y0 (100.0) 86 #define VIPS_C_Z0 (118.2300) 87 88 #define VIPS_E_X0 (100.0) 89 #define VIPS_E_Y0 (100.0) 90 #define VIPS_E_Z0 (100.0) 91 92 #define VIPS_D3250_X0 (105.6590) 93 #define VIPS_D3250_Y0 (100.0) 94 #define VIPS_D3250_Z0 (45.8501) 95 96 typedef enum { 97 VIPS_INTENT_PERCEPTUAL = 0, 98 VIPS_INTENT_RELATIVE, 99 VIPS_INTENT_SATURATION, 100 VIPS_INTENT_ABSOLUTE, 101 VIPS_INTENT_LAST 102 } VipsIntent; 103 104 typedef enum { 105 VIPS_PCS_LAB, 106 VIPS_PCS_XYZ, 107 VIPS_PCS_LAST 108 } VipsPCS; 109 110 gboolean vips_colourspace_issupported( const VipsImage *image ); 111 int vips_colourspace( VipsImage *in, VipsImage **out, 112 VipsInterpretation space, ... ) 113 __attribute__((sentinel)); 114 115 int vips_LabQ2sRGB( VipsImage *in, VipsImage **out, ... ) 116 __attribute__((sentinel)); 117 int vips_rad2float( VipsImage *in, VipsImage **out, ... ) 118 __attribute__((sentinel)); 119 int vips_float2rad( VipsImage *in, VipsImage **out, ... ) 120 __attribute__((sentinel)); 121 int vips_LabS2LabQ( VipsImage *in, VipsImage **out, ... ) 122 __attribute__((sentinel)); 123 int vips_LabQ2LabS( VipsImage *in, VipsImage **out, ... ) 124 __attribute__((sentinel)); 125 int vips_LabQ2Lab( VipsImage *in, VipsImage **out, ... ) 126 __attribute__((sentinel)); 127 int vips_Lab2LabQ( VipsImage *in, VipsImage **out, ... ) 128 __attribute__((sentinel)); 129 int vips_LCh2Lab( VipsImage *in, VipsImage **out, ... ) 130 __attribute__((sentinel)); 131 int vips_Lab2LCh( VipsImage *in, VipsImage **out, ... ) 132 __attribute__((sentinel)); 133 int vips_Yxy2Lab( VipsImage *in, VipsImage **out, ... ) 134 __attribute__((sentinel)); 135 int vips_CMC2XYZ( VipsImage *in, VipsImage **out, ... ) 136 __attribute__((sentinel)); 137 int vips_Lab2XYZ( VipsImage *in, VipsImage **out, ... ) 138 __attribute__((sentinel)); 139 int vips_XYZ2Lab( VipsImage *in, VipsImage **out, ... ) 140 __attribute__((sentinel)); 141 142 int vips_XYZ2scRGB( VipsImage *in, VipsImage **out, ... ) 143 __attribute__((sentinel)); 144 int vips_scRGB2sRGB( VipsImage *in, VipsImage **out, ... ) 145 __attribute__((sentinel)); 146 int vips_scRGB2BW( VipsImage *in, VipsImage **out, ... ) 147 __attribute__((sentinel)); 148 int vips_sRGB2scRGB( VipsImage *in, VipsImage **out, ... ) 149 __attribute__((sentinel)); 150 int vips_scRGB2XYZ( VipsImage *in, VipsImage **out, ... ) 151 __attribute__((sentinel)); 152 int vips_HSV2sRGB( VipsImage *in, VipsImage **out, ... ) 153 __attribute__((sentinel)); 154 int vips_sRGB2HSV( VipsImage *in, VipsImage **out, ... ) 155 __attribute__((sentinel)); 156 157 int vips_LCh2CMC( VipsImage *in, VipsImage **out, ... ) 158 __attribute__((sentinel)); 159 int vips_CMC2LCh( VipsImage *in, VipsImage **out, ... ) 160 __attribute__((sentinel)); 161 int vips_XYZ2Yxy( VipsImage *in, VipsImage **out, ... ) 162 __attribute__((sentinel)); 163 int vips_Yxy2XYZ( VipsImage *in, VipsImage **out, ... ) 164 __attribute__((sentinel)); 165 int vips_LabS2Lab( VipsImage *in, VipsImage **out, ... ) 166 __attribute__((sentinel)); 167 int vips_Lab2LabS( VipsImage *in, VipsImage **out, ... ) 168 __attribute__((sentinel)); 169 170 int vips_CMYK2XYZ( VipsImage *in, VipsImage **out, ... ) 171 __attribute__((sentinel)); 172 int vips_XYZ2CMYK( VipsImage *in, VipsImage **out, ... ) 173 __attribute__((sentinel)); 174 175 int vips_profile_load( const char *name, VipsBlob **profile, ... ) 176 __attribute__((sentinel)); 177 int vips_icc_present( void ); 178 int vips_icc_transform( VipsImage *in, VipsImage **out, 179 const char *output_profile, ... ) 180 __attribute__((sentinel)); 181 int vips_icc_import( VipsImage *in, VipsImage **out, ... ) 182 __attribute__((sentinel)); 183 int vips_icc_export( VipsImage *in, VipsImage **out, ... ) 184 __attribute__((sentinel)); 185 int vips_icc_ac2rc( VipsImage *in, VipsImage **out, 186 const char *profile_filename ); 187 gboolean vips_icc_is_compatible_profile( VipsImage *image, 188 const void *data, size_t data_length ); 189 190 int vips_dE76( VipsImage *left, VipsImage *right, VipsImage **out, ... ) 191 __attribute__((sentinel)); 192 int vips_dE00( VipsImage *left, VipsImage *right, VipsImage **out, ... ) 193 __attribute__((sentinel)); 194 int vips_dECMC( VipsImage *left, VipsImage *right, VipsImage **out, ... ) 195 __attribute__((sentinel)); 196 197 void vips_col_Lab2XYZ( float L, float a, float b, 198 float *X, float *Y, float *Z ); 199 void vips_col_XYZ2Lab( float X, float Y, float Z, 200 float *L, float *a, float *b ); 201 double vips_col_ab2h( double a, double b ); 202 void vips_col_ab2Ch( float a, float b, float *C, float *h ); 203 void vips_col_Ch2ab( float C, float h, float *a, float *b ); 204 205 float vips_col_L2Lcmc( float L ); 206 float vips_col_C2Ccmc( float C ); 207 float vips_col_Ch2hcmc( float C, float h ); 208 209 void vips_col_make_tables_CMC( void ); 210 float vips_col_Lcmc2L( float Lcmc ); 211 float vips_col_Ccmc2C( float Ccmc ); 212 float vips_col_Chcmc2h( float C, float hcmc ); 213 214 int vips_col_sRGB2scRGB_8( int r, int g, int b, float *R, float *G, float *B ); 215 int vips_col_sRGB2scRGB_16( int r, int g, int b, float *R, float *G, float *B ); 216 int vips_col_sRGB2scRGB_8_noclip( int r, int g, int b, 217 float *R, float *G, float *B ); 218 int vips_col_sRGB2scRGB_16_noclip( int r, int g, int b, 219 float *R, float *G, float *B ); 220 221 int vips_col_scRGB2XYZ( float R, float G, float B, 222 float *X, float *Y, float *Z ); 223 int vips_col_XYZ2scRGB( float X, float Y, float Z, 224 float *R, float *G, float *B ); 225 226 int vips_col_scRGB2sRGB_8( float R, float G, float B, 227 int *r, int *g, int *b, int *og ); 228 int vips_col_scRGB2sRGB_16( float R, float G, float B, 229 int *r, int *g, int *b, int *og ); 230 int vips_col_scRGB2BW_16( float R, float G, float B, int *g, int *og ); 231 int vips_col_scRGB2BW_8( float R, float G, float B, int *g, int *og ); 232 233 float vips_pythagoras( float L1, float a1, float b1, 234 float L2, float a2, float b2 ); 235 float vips_col_dE00( 236 float L1, float a1, float b1, float L2, float a2, float b2 ); 237 238 #ifdef __cplusplus 239 } 240 #endif /*__cplusplus*/ 241 242 #endif /*VIPS_COLOUR_H*/ 243