1 /* Copyright (C) 2001-2012 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Client color structure definition */
18 
19 #ifndef gsccolor_INCLUDED
20 #  define gsccolor_INCLUDED
21 
22 #include "gsstype.h"		/* for extern_st */
23 
24 /* Pattern instance, usable in color. */
25 #ifndef gs_pattern_instance_DEFINED
26 #  define gs_pattern_instance_DEFINED
27 typedef struct gs_pattern_instance_s gs_pattern_instance_t;
28 #endif
29 
30 /*
31  * Define the maximum number of components in a client color.
32  * This must be at least 4, and should be at least 6 to accommodate
33  * hexachrome DeviceN color spaces. We saw 9-component (bug 691002)
34  * and 13-component (bug 691425) colors in the wild.   Also define
35  * the maximum number of colorants that we will support within a
36  * single DeviceN color space.  AR supports 32.
37  */
38 #ifndef GS_CLIENT_COLOR_MAX_COMPONENTS		/* Allow override with XCFLAGS */
39 #  define GS_CLIENT_COLOR_MAX_COMPONENTS (64)
40 #endif
41 
42 #ifndef MAX_COMPONENTS_IN_DEVN
43 #  define MAX_COMPONENTS_IN_DEVN (64)
44 #endif
45 
46 /* There is a speed penalty for supporting lots of spot colors, so certain
47  * devices (tiffsep, tiffsep1, psdcmyk, etc) offer -dMaxSpots. This allows
48  * us to compile in a high 'hard' limit on the number of components
49  * (GS_CLIENT_COLOR_MAX_COMPONENTS) and yet to allow runtime selection of the
50  * real number to be used.
51  *
52  * GS_SOFT_MAX_SPOTS is the maximum number of spots we allow by default;
53  * currently this is set to 10, to match the (historical) limit of 14
54  * components that Ghostscript has shipped with for years.
55  */
56 #ifndef GS_SOFT_MAX_SPOTS
57 #define GS_SOFT_MAX_SPOTS 10
58 #endif
59 
60 /* Paint (non-Pattern) colors */
61 typedef struct gs_paint_color_s {
62     float values[GS_CLIENT_COLOR_MAX_COMPONENTS];
63     /* CAUTION: The shading decomposition algorithm may allocate
64        a smaller space when a small number of color components is in use.
65     */
66 } gs_paint_color;
67 
68 /* General colors */
69 #ifndef gs_client_color_DEFINED
70 #  define gs_client_color_DEFINED
71 typedef struct gs_client_color_s gs_client_color;
72 
73 #endif
74 struct gs_client_color_s {
75     gs_pattern_instance_t *pattern;
76     gs_paint_color paint;	/* also color for uncolored pattern */
77     /* CAUTION: gs_paint_color structure must be the last field in
78        gs_client_color_s to allow allocating a smaller space when
79        a small number of color components is in use.
80     */
81 };
82 
83 extern_st(st_client_color);
84 #define public_st_client_color() /* in gscolor.c */\
85   gs_public_st_ptrs1(st_client_color, gs_client_color, "gs_client_color",\
86     client_color_enum_ptrs, client_color_reloc_ptrs, pattern)
87 #define st_client_color_max_ptrs 1
88 
89 /* Define the color space for a transparency */
90 /* Used to keep track of parent versus child */
91 /* color space changes with Smask and for */
92 /* blending */
93 typedef enum {
94     GRAY_SCALE,
95     DEVICE_RGB,
96     DEVICE_CMYK,
97     CIE_XYZ,
98     DEVICEN,
99     ICC,
100     UNKNOWN,
101     OTHER
102 } gs_transparency_color_t;
103 
104 #endif /* gsccolor_INCLUDED */
105