colour.h 7.4 KB

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