Mac OS 9
CGColorSpace.h
Go to the documentation of this file.
1 
19 #ifndef __CGCOLORSPACE__
20 #define __CGCOLORSPACE__
21 
22 #ifndef __CGBASE__
23 #include <CGBase.h>
24 #endif
25 
26 #ifndef __CGDATAPROVIDER__
27 #include <CGDataProvider.h>
28 #endif
29 
30 #if PRAGMA_ONCE
31 #pragma once
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #if PRAGMA_IMPORT
40 #pragma import on
41 #endif
42 
43 #if PRAGMA_STRUCT_ALIGN
44 #pragma options align = mac68k
45 #elif PRAGMA_STRUCT_PACKPUSH
46 #pragma pack(push, 2)
47 #elif PRAGMA_STRUCT_PACK
48 #pragma pack(2)
49 #endif
50 
51 #if PRAGMA_ENUM_ALWAYSINT
52 #if defined(__fourbyteints__) && !__fourbyteints__
53 #define __CGCOLORSPACE__RESTORE_TWOBYTEINTS
54 #pragma fourbyteints on
55 #endif
56 #pragma enumsalwaysint on
57 #elif PRAGMA_ENUM_OPTIONS
58 #pragma option enum =int
59 #elif PRAGMA_ENUM_PACK
60 #if __option(pack_enums)
61 #define __CGCOLORSPACE__RESTORE_PACKED_ENUMS
62 #pragma options(!pack_enums)
63 #endif
64 #endif
65 
66  typedef struct CGColorSpace *CGColorSpaceRef;
67  enum CGColorRenderingIntent
68  {
69  kCGRenderingIntentDefault = 0,
70  kCGRenderingIntentAbsoluteColorimetric = 1,
71  kCGRenderingIntentRelativeColorimetric = 2,
72  kCGRenderingIntentPerceptual = 3,
73  kCGRenderingIntentSaturation = 4
74  };
75  typedef enum CGColorRenderingIntent CGColorRenderingIntent;
76 
78  /* Create a DeviceGray colorspace. */
87  CGColorSpaceRef
89 
90  /* Create a DeviceRGB colorspace. */
99  CGColorSpaceRef
101 
102  /* Create a DeviceCMYK colorspace. */
111  CGColorSpaceRef
113 
115  /* Create a calibrated gray colorspace. `whitePoint' is an array of 3
116  * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
117  * the diffuse white point. `blackPoint' is an array of 3 numbers
118  * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
119  * black point. `gamma' defines the gamma for the gray component. */
128  CGColorSpaceRef
129  CGColorSpaceCreateCalibratedGray(const float whitePoint[3],
130  const float blackPoint[3], float gamma);
131 
132  /* Create a calibrated RGB colorspace. `whitePoint' is an array of 3
133  * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
134  * the diffuse white point. `blackPoint' is an array of 3 numbers
135  * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
136  * black point. `gamma' is an array of 3 numbers specifying the gamma for
137  * the red, green, and blue components of the color space. `matrix' is an
138  * array of 9 numbers specifying the linear interpretation of the
139  * gamma-modified RGB values of the colorspace with respect to the final
140  * XYZ representation. */
149  CGColorSpaceRef
150  CGColorSpaceCreateCalibratedRGB(const float whitePoint[3],
151  const float blackPoint[3], const float gamma[3],
152  const float matrix[9]);
153 
154  /* Create an L*a*b* colorspace. `whitePoint' is an array of 3 numbers
155  * specifying the tristimulus value, in the CIE 1931 XYZ-space, of the
156  * diffuse white point. `blackPoint' is an array of 3 numbers specifying
157  * the tristimulus value, in CIE 1931 XYZ-space, of the diffuse black
158  * point. `range' is an array of four numbers specifying the range of valid
159  * values for the a* and b* components of the color space. */
168  CGColorSpaceRef
169  CGColorSpaceCreateLab(const float whitePoint[3], const float blackPoint[3],
170  const float range[4]);
171 
172  /* Create an ICC-based colorspace. `nComponents' specifies the number of
173  * color components in the color space defined by the ICC profile data.
174  * This must match the number of components actually in the ICC profile,
175  * and must be 1, 3, or 4. `range' is an array of 2*nComponents numbers
176  * specifying the minimum and maximum valid values of the corresponding
177  * color components, so that for color component k, range[2*k] <= c[k] <=
178  * range[2*k+1], where c[k] is the k'th color component. `profile' is a
179  * data provider specifying the ICC profile. `alternate' specifies an
180  * alternate colorspace to be used in case the ICC profile is not
181  * supported. It must have `nComponents' color components. If `alternate'
182  * is NULL, then the color space used will be DeviceGray, DeviceRGB, or
183  * DeviceCMYK, depending on whether `nComponents' is 1, 3, or 4,
184  * respectively. */
193  CGColorSpaceRef
194  CGColorSpaceCreateICCBased(size_t nComponents, const float *range,
195  CGDataProviderRef profile,
196  CGColorSpaceRef alternateSpace);
197 
199  /* Create an indexed colorspace. A sample value in an indexed color space
200  * is treated as an index into the color table of the color space. `base'
201  * specifies the base color space in which the values in the color table
202  * are to be interpreted. `lastIndex' is an integer which specifies the
203  * maximum valid index value; it must be less than or equal to 255.
204  * `colorTable' is an array of m * (lastIndex + 1) bytes, where m is
205  * the number of color components in the base color space. Each byte
206  * is an unsigned integer in the range 0 to 255 that is scaled to the
207  * range of the corresponding color component in the base color space. */
216  CGColorSpaceRef
217  CGColorSpaceCreateIndexed(CGColorSpaceRef baseSpace, size_t lastIndex,
218  const unsigned char *colorTable);
219 
220  /* Create a pattern colorspace. `baseSpace' is the underlying colorspace of
221  * the pattern colorspace. For colored patterns, `baseSpace' should be
222  * NULL; for uncolored patterns, `baseSpace' specifies the colorspace of
223  * colors which will be painted through the pattern. */
232  CGColorSpaceRef
233  CGColorSpaceCreatePattern(CGColorSpaceRef baseSpace);
234 
235  /* Create a CGColorSpace using `platformColorSpaceReference', a pointer to
236  * a platform-specific color space reference. For MacOS X,
237  * `platformColorSpaceReference' should be a pointer to a CMProfileRef. */
246  CGColorSpaceRef
247  CGColorSpaceCreateWithPlatformColorSpace(void *platformColorSpaceReference);
248 
250  /* Return the number of color components supported by the colorspace `cs'. */
259  size_t
261 
263  /* Increment the retain count of `cs' and return it. All colorspaces are
264  * created with an initial retain count of 1. */
273  CGColorSpaceRef
274  CGColorSpaceRetain(CGColorSpaceRef cs);
275 
276  /* Decrement the retain count of `cs'. If the retain count reaches 0, then
277  * release it and any associated resources. */
286  void
287  CGColorSpaceRelease(CGColorSpaceRef cs);
288 
289 #if PRAGMA_ENUM_ALWAYSINT
290 #pragma enumsalwaysint reset
291 #ifdef __CGCOLORSPACE__RESTORE_TWOBYTEINTS
292 #pragma fourbyteints off
293 #endif
294 #elif PRAGMA_ENUM_OPTIONS
295 #pragma option enum =reset
296 #elif defined(__CGCOLORSPACE__RESTORE_PACKED_ENUMS)
297 #pragma options(pack_enums)
298 #endif
299 
300 #if PRAGMA_STRUCT_ALIGN
301 #pragma options align = reset
302 #elif PRAGMA_STRUCT_PACKPUSH
303 #pragma pack(pop)
304 #elif PRAGMA_STRUCT_PACK
305 #pragma pack()
306 #endif
307 
308 #ifdef PRAGMA_IMPORT_OFF
309 #pragma import off
310 #elif PRAGMA_IMPORT
311 #pragma import reset
312 #endif
313 
314 #ifdef __cplusplus
315 }
316 #endif
317 
318 #endif /* __CGCOLORSPACE__ */
xxx put contents here xxx
CGColorSpaceRef CGColorSpaceCreateLab(const float whitePoint[3], const float blackPoint[3], const float range[4])
CGColorSpaceRef CGColorSpaceCreateIndexed(CGColorSpaceRef baseSpace, size_t lastIndex, const unsigned char *colorTable)
CGColorSpaceRef CGColorSpaceCreateDeviceGray(void)
CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef cs)
CGColorSpaceRef CGColorSpaceCreatePattern(CGColorSpaceRef baseSpace)
CGColorSpaceRef CGColorSpaceCreateCalibratedGray(const float whitePoint[3], const float blackPoint[3], float gamma)
CGColorSpaceRef CGColorSpaceCreateWithPlatformColorSpace(void *platformColorSpaceReference)
CGColorSpaceRef CGColorSpaceCreateICCBased(size_t nComponents, const float *range, CGDataProviderRef profile, CGColorSpaceRef alternateSpace)
CGColorSpaceRef CGColorSpaceCreateCalibratedRGB(const float whitePoint[3], const float blackPoint[3], const float gamma[3], const float matrix[9])
CGColorSpaceRef CGColorSpaceCreateDeviceCMYK(void)
size_t CGColorSpaceGetNumberOfComponents(CGColorSpaceRef cs)
CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void)
void CGColorSpaceRelease(CGColorSpaceRef cs)
xxx put contents here xxx
Definition: CMICCProfile.h:821