Untitled


SUBMITTED BY: Guest

DATE: Nov. 25, 2014, 7:18 a.m.

FORMAT: Text only

SIZE: 11.6 kB

HITS: 48365

  1. /* CoreGraphics - CGColorSpace.h
  2. Copyright (c) 1999-2013 Apple Inc.
  3. All rights reserved. */
  4. #ifndef CGCOLORSPACE_H_
  5. #define CGCOLORSPACE_H_
  6. typedef struct CGColorSpace *CGColorSpaceRef;
  7. #include <CoreGraphics/CGBase.h>
  8. #include <CoreGraphics/CGDataProvider.h>
  9. CF_IMPLICIT_BRIDGING_ENABLED
  10. /* Color rendering intents. */
  11. enum CGColorRenderingIntent {
  12. kCGRenderingIntentDefault,
  13. kCGRenderingIntentAbsoluteColorimetric,
  14. kCGRenderingIntentRelativeColorimetric,
  15. kCGRenderingIntentPerceptual,
  16. kCGRenderingIntentSaturation
  17. };
  18. typedef enum CGColorRenderingIntent CGColorRenderingIntent;
  19. /* The model of a color space. */
  20. enum CGColorSpaceModel {
  21. kCGColorSpaceModelUnknown = -1,
  22. kCGColorSpaceModelMonochrome,
  23. kCGColorSpaceModelRGB,
  24. kCGColorSpaceModelCMYK,
  25. kCGColorSpaceModelLab,
  26. kCGColorSpaceModelDeviceN,
  27. kCGColorSpaceModelIndexed,
  28. kCGColorSpaceModelPattern
  29. };
  30. typedef enum CGColorSpaceModel CGColorSpaceModel;
  31. /* The name of the "Generic" gray color space. */
  32. CG_EXTERN const CFStringRef kCGColorSpaceGenericGray
  33. CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
  34. /* The name of the "Generic" RGB color space. */
  35. CG_EXTERN const CFStringRef kCGColorSpaceGenericRGB
  36. CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
  37. /* The name of the "Generic" CMYK color space. */
  38. CG_EXTERN const CFStringRef kCGColorSpaceGenericCMYK
  39. CG_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_NA);
  40. /* The name of the "Generic" linear RGB color space. This is the same as
  41. `kCGColorSpaceGenericRGB' but with a 1.0 gamma. */
  42. CG_EXTERN const CFStringRef kCGColorSpaceGenericRGBLinear
  43. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
  44. /* The name of the Adobe RGB (1998) color space. For more information, see
  45. "Adobe RGB (1998) Color Image Encoding", Version 2005-05, Adobe Systems
  46. Inc. (http://www.adobe.com). */
  47. CG_EXTERN const CFStringRef kCGColorSpaceAdobeRGB1998
  48. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
  49. /* The name of the sRGB color space. The capitalization in the name, while
  50. strictly inaccurate, avoids interpretational ambiguity. For more
  51. information, see IEC 61966-2-1 (1999-10): "Multimedia systems and
  52. equipment - Colour measurement and management - Part 2-1: Colour
  53. management - Default RGB colour space - sRGB". */
  54. CG_EXTERN const CFStringRef kCGColorSpaceSRGB
  55. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
  56. /* The "Generic" gray color space with γ = 2.2. */
  57. CG_EXTERN const CFStringRef kCGColorSpaceGenericGrayGamma2_2
  58. CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
  59. /* Create a DeviceGray color space. */
  60. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateDeviceGray(void)
  61. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  62. /* Create a DeviceRGB color space. */
  63. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void)
  64. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  65. /* Create a DeviceCMYK color space. */
  66. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateDeviceCMYK(void)
  67. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  68. /* Create a calibrated gray color space. `whitePoint' is an array of 3
  69. numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
  70. the diffuse white point. `blackPoint' is an array of 3 numbers specifying
  71. the tristimulus value, in CIE 1931 XYZ-space, of the diffuse black point.
  72. `gamma' defines the gamma for the gray component. */
  73. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateCalibratedGray(const CGFloat
  74. whitePoint[3], const CGFloat blackPoint[3], CGFloat gamma)
  75. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  76. /* Create a calibrated RGB color space. `whitePoint' is an array of 3
  77. numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
  78. the diffuse white point. `blackPoint' is an array of 3 numbers specifying
  79. the tristimulus value, in CIE 1931 XYZ-space, of the diffuse black point.
  80. `gamma' is an array of 3 numbers specifying the gamma for the red, green,
  81. and blue components of the color space. `matrix' is an array of 9 numbers
  82. specifying the linear interpretation of the gamma-modified RGB values of
  83. the color space with respect to the final XYZ representation. */
  84. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateCalibratedRGB(const CGFloat
  85. whitePoint[3], const CGFloat blackPoint[3], const CGFloat gamma[3],
  86. const CGFloat matrix[9]) CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  87. /* Create an L*a*b* color space. `whitePoint' is an array of 3 numbers
  88. specifying the tristimulus value, in the CIE 1931 XYZ-space, of the
  89. diffuse white point. `blackPoint' is an array of 3 numbers specifying the
  90. tristimulus value, in CIE 1931 XYZ-space, of the diffuse black point.
  91. `range' is an array of four numbers specifying the range of valid values
  92. for the a* and b* components of the color space. */
  93. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateLab(const CGFloat whitePoint[3],
  94. const CGFloat blackPoint[3], const CGFloat range[4])
  95. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  96. /* Create an ICC-based color space using the ICC profile specified by
  97. `data'. */
  98. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateWithICCProfile(CFDataRef data)
  99. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  100. /* Create an ICC-based color space. `nComponents' specifies the number of
  101. color components in the color space defined by the ICC profile data. This
  102. must match the number of components actually in the ICC profile, and must
  103. be 1, 3, or 4. `range' is an array of 2*nComponents numbers specifying
  104. the minimum and maximum valid values of the corresponding color
  105. components, so that for color component k, range[2*k] <= c[k] <=
  106. range[2*k+1], where c[k] is the k'th color component. `profile' is a data
  107. provider specifying the ICC profile. `alternate' specifies an alternate
  108. color space to be used in case the ICC profile is not supported. It must
  109. have `nComponents' color components. If `alternate' is NULL, then the
  110. color space used will be DeviceGray, DeviceRGB, or DeviceCMYK, depending
  111. on whether `nComponents' is 1, 3, or 4, respectively. */
  112. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateICCBased(size_t nComponents,
  113. const CGFloat *range, CGDataProviderRef profile, CGColorSpaceRef alternate)
  114. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  115. /* Create an indexed color space. A sample value in an indexed color space
  116. is treated as an index into the color table of the color space. `base'
  117. specifies the base color space in which the values in the color table are
  118. to be interpreted. `lastIndex' is an integer which specifies the maximum
  119. valid index value; it must be less than or equal to 255. `colorTable' is
  120. an array of m * (lastIndex + 1) bytes, where m is the number of color
  121. components in the base color space. Each byte is an unsigned integer in
  122. the range 0 to 255 that is scaled to the range of the corresponding color
  123. component in the base color space. */
  124. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateIndexed(CGColorSpaceRef baseSpace,
  125. size_t lastIndex, const unsigned char *colorTable)
  126. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  127. /* Create a pattern color space. `baseSpace' is the underlying color space
  128. of the pattern color space. For colored patterns, `baseSpace' should be
  129. NULL; for uncolored patterns, `baseSpace' specifies the color space of
  130. colors which will be painted through the pattern. */
  131. CG_EXTERN CGColorSpaceRef CGColorSpaceCreatePattern(CGColorSpaceRef baseSpace)
  132. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  133. /* Create a color space using `ref', a platform-specific color space
  134. reference. For MacOS X, `ref' should be a CMProfileRef. */
  135. CG_EXTERN CGColorSpaceRef
  136. CGColorSpaceCreateWithPlatformColorSpace(const void *ref)
  137. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA);
  138. /* Create a color space using `name' as the identifier for the color
  139. space. */
  140. CG_EXTERN CGColorSpaceRef CGColorSpaceCreateWithName(CFStringRef name)
  141. CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
  142. /* Equivalent to `CFRetain(space)', except it doesn't crash (as CFRetain
  143. does) if `space' is NULL. */
  144. CG_EXTERN CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space)
  145. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  146. /* Equivalent to `CFRelease(space)', except it doesn't crash (as CFRelease
  147. does) if `space' is NULL. */
  148. CG_EXTERN void CGColorSpaceRelease(CGColorSpaceRef space)
  149. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  150. /* Return the name used to create the color space `space', or NULL if the
  151. color space was not created using `CGColorSpaceCreateWithName'. */
  152. CG_EXTERN CFStringRef CGColorSpaceCopyName(CGColorSpaceRef space)
  153. CG_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
  154. /* Return the CFTypeID for CGColorSpaces. */
  155. CG_EXTERN CFTypeID CGColorSpaceGetTypeID(void)
  156. CG_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
  157. /* Return the number of color components in the color space `space'. */
  158. CG_EXTERN size_t CGColorSpaceGetNumberOfComponents(CGColorSpaceRef space)
  159. CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
  160. /* Return the color space model of `space'. */
  161. CG_EXTERN CGColorSpaceModel CGColorSpaceGetModel(CGColorSpaceRef space)
  162. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  163. /* Return the base color space of `space' if `space' is a pattern or indexed
  164. color space; otherwise, return NULL. To determine whether a color space
  165. is an indexed or pattern color space, use `CGColorSpaceGetModel'. */
  166. CG_EXTERN CGColorSpaceRef CGColorSpaceGetBaseColorSpace(CGColorSpaceRef space)
  167. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  168. /* Return the number of entries in the color table of `space' if `space' is
  169. an indexed color space; otherwise, return 0. To determine whether a color
  170. space is an indexed color space, use `CGColorSpaceGetModel'. */
  171. CG_EXTERN size_t CGColorSpaceGetColorTableCount(CGColorSpaceRef space)
  172. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  173. /* Copy the entries in the color table of `space' to `table' if `space' is
  174. an indexed color space; otherwise, do nothing. The array pointed to by
  175. `table' should be at least as large as the number of entries in the color
  176. table; the returned data is in the same format as that passed to
  177. `CGColorSpaceCreateIndexed'. To determine whether a color space is an
  178. indexed color space, use `CGColorSpaceGetModel'. */
  179. CG_EXTERN void CGColorSpaceGetColorTable(CGColorSpaceRef space, uint8_t *table)
  180. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
  181. /* Return a copy of the ICC profile of `space', or NULL if the color space
  182. doesn't have an ICC profile. */
  183. CG_EXTERN CFDataRef CGColorSpaceCopyICCProfile(CGColorSpaceRef space)
  184. CG_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_6_0);
  185. CF_IMPLICIT_BRIDGING_DISABLED
  186. #endif /* CGCOLORSPACE_H_ */

comments powered by Disqus