qcms.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. #ifndef QCMS_H
  2. #define QCMS_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* if we've already got an ICC_H header we can ignore the following */
  7. #ifndef ICC_H
  8. /* icc34 defines */
  9. /*****************************************************************
  10. Copyright (c) 1994-1996 SunSoft, Inc.
  11. Rights Reserved
  12. Permission is hereby granted, free of charge, to any person
  13. obtaining a copy of this software and associated documentation
  14. files (the "Software"), to deal in the Software without restrict-
  15. ion, including without limitation the rights to use, copy, modify,
  16. merge, publish distribute, sublicense, and/or sell copies of the
  17. Software, and to permit persons to whom the Software is furnished
  18. to do so, subject to the following conditions:
  19. The above copyright notice and this permission notice shall be
  20. included in all copies or substantial portions of the Software.
  21. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  23. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
  24. INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
  25. COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  26. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  27. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  28. OTHER DEALINGS IN THE SOFTWARE.
  29. Except as contained in this notice, the name of SunSoft, Inc.
  30. shall not be used in advertising or otherwise to promote the
  31. sale, use or other dealings in this Software without written
  32. authorization from SunSoft Inc.
  33. ******************************************************************/
  34. /*
  35. * Color Space Signatures
  36. * Note that only icSigXYZData and icSigLabData are valid
  37. * Profile Connection Spaces (PCSs)
  38. */
  39. typedef enum {
  40. icSigXYZData = 0x58595A20L, /* 'XYZ ' */
  41. icSigLabData = 0x4C616220L, /* 'Lab ' */
  42. icSigLuvData = 0x4C757620L, /* 'Luv ' */
  43. icSigYCbCrData = 0x59436272L, /* 'YCbr' */
  44. icSigYxyData = 0x59787920L, /* 'Yxy ' */
  45. icSigRgbData = 0x52474220L, /* 'RGB ' */
  46. icSigGrayData = 0x47524159L, /* 'GRAY' */
  47. icSigHsvData = 0x48535620L, /* 'HSV ' */
  48. icSigHlsData = 0x484C5320L, /* 'HLS ' */
  49. icSigCmykData = 0x434D594BL, /* 'CMYK' */
  50. icSigCmyData = 0x434D5920L, /* 'CMY ' */
  51. icSig2colorData = 0x32434C52L, /* '2CLR' */
  52. icSig3colorData = 0x33434C52L, /* '3CLR' */
  53. icSig4colorData = 0x34434C52L, /* '4CLR' */
  54. icSig5colorData = 0x35434C52L, /* '5CLR' */
  55. icSig6colorData = 0x36434C52L, /* '6CLR' */
  56. icSig7colorData = 0x37434C52L, /* '7CLR' */
  57. icSig8colorData = 0x38434C52L, /* '8CLR' */
  58. icSig9colorData = 0x39434C52L, /* '9CLR' */
  59. icSig10colorData = 0x41434C52L, /* 'ACLR' */
  60. icSig11colorData = 0x42434C52L, /* 'BCLR' */
  61. icSig12colorData = 0x43434C52L, /* 'CCLR' */
  62. icSig13colorData = 0x44434C52L, /* 'DCLR' */
  63. icSig14colorData = 0x45434C52L, /* 'ECLR' */
  64. icSig15colorData = 0x46434C52L, /* 'FCLR' */
  65. icMaxEnumData = 0xFFFFFFFFL
  66. } icColorSpaceSignature;
  67. #endif
  68. #include <stdio.h>
  69. typedef int qcms_bool;
  70. struct _qcms_transform;
  71. typedef struct _qcms_transform qcms_transform;
  72. struct _qcms_profile;
  73. typedef struct _qcms_profile qcms_profile;
  74. /* these values match the Rendering Intent values from the ICC spec */
  75. typedef enum {
  76. QCMS_INTENT_DEFAULT = 0,
  77. QCMS_INTENT_PERCEPTUAL = 0,
  78. QCMS_INTENT_RELATIVE_COLORIMETRIC = 1,
  79. QCMS_INTENT_SATURATION = 2,
  80. QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3
  81. } qcms_intent;
  82. //XXX: I don't really like the _DATA_ prefix
  83. typedef enum {
  84. QCMS_DATA_RGB_8,
  85. QCMS_DATA_RGBA_8,
  86. QCMS_DATA_GRAY_8,
  87. QCMS_DATA_GRAYA_8
  88. } qcms_data_type;
  89. /* the names for the following two types are sort of ugly */
  90. typedef struct
  91. {
  92. double x;
  93. double y;
  94. double Y;
  95. } qcms_CIE_xyY;
  96. typedef struct
  97. {
  98. qcms_CIE_xyY red;
  99. qcms_CIE_xyY green;
  100. qcms_CIE_xyY blue;
  101. } qcms_CIE_xyYTRIPLE;
  102. qcms_profile* qcms_profile_create_rgb_with_gamma(
  103. qcms_CIE_xyY white_point,
  104. qcms_CIE_xyYTRIPLE primaries,
  105. float gamma);
  106. qcms_profile* qcms_profile_from_memory(const void *mem, size_t size);
  107. qcms_profile* qcms_profile_from_file(FILE *file);
  108. qcms_profile* qcms_profile_from_path(const char *path);
  109. #ifdef _WIN32
  110. qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path);
  111. #endif
  112. qcms_profile* qcms_profile_sRGB(void);
  113. void qcms_profile_release(qcms_profile *profile);
  114. qcms_bool qcms_profile_is_bogus(qcms_profile *profile);
  115. qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile);
  116. icColorSpaceSignature qcms_profile_get_color_space(qcms_profile *profile);
  117. void qcms_profile_precache_output_transform(qcms_profile *profile);
  118. qcms_transform* qcms_transform_create(
  119. qcms_profile *in, qcms_data_type in_type,
  120. qcms_profile* out, qcms_data_type out_type,
  121. qcms_intent intent);
  122. void qcms_transform_release(qcms_transform *);
  123. void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length);
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127. #endif