summaryrefslogtreecommitdiff
path: root/base/gsccolor.h
blob: c5ef8227de498371c8c4e582d4debbb7db49a996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* Copyright (C) 2001-2023 Artifex Software, Inc.
   All Rights Reserved.

   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied,
   modified or distributed except as expressly authorized under the terms
   of the license contained in the file LICENSE in this distribution.

   Refer to licensing information at http://www.artifex.com or contact
   Artifex Software, Inc.,  39 Mesa Street, Suite 108A, San Francisco,
   CA 94129, USA, for further information.
*/


/* Client color structure definition */

#ifndef gsccolor_INCLUDED
#  define gsccolor_INCLUDED

#include "gsstype.h"		/* for extern_st */

/* Pattern instance, usable in color. */
typedef struct gs_pattern_instance_s gs_pattern_instance_t;

/*
 * Define the maximum number of components in a client color.
 * This must be at least 4, and should be at least 6 to accommodate
 * hexachrome DeviceN color spaces. We saw 9-component (bug 691002)
 * and 13-component (bug 691425) colors in the wild.   Also define
 * the maximum number of colorants that we will support within a
 * single DeviceN color space.  AR supports 32.
 */
#ifndef GS_CLIENT_COLOR_MAX_COMPONENTS		/* Allow override with XCFLAGS */
#  define GS_CLIENT_COLOR_MAX_COMPONENTS (64)
#endif

#ifndef MAX_COMPONENTS_IN_DEVN
#  define MAX_COMPONENTS_IN_DEVN (64)
#endif

/* There is a speed penalty for supporting lots of spot colors, so certain
 * devices (tiffsep, tiffsep1, psdcmyk, etc) offer -dMaxSpots. This allows
 * us to compile in a high 'hard' limit on the number of components
 * (GS_CLIENT_COLOR_MAX_COMPONENTS) and yet to allow runtime selection of the
 * real number to be used.
 *
 * GS_SOFT_MAX_SPOTS is the maximum number of spots we allow by default;
 * currently this is set to 10, to match the (historical) limit of 14
 * components that Ghostscript has shipped with for years.
 */
#ifndef GS_SOFT_MAX_SPOTS
#define GS_SOFT_MAX_SPOTS 10
#endif

/* Paint (non-Pattern) colors */
typedef struct gs_paint_color_s {
    float values[GS_CLIENT_COLOR_MAX_COMPONENTS];
    /* CAUTION: The shading decomposition algorithm may allocate
       a smaller space when a small number of color components is in use.
    */
} gs_paint_color;

/* General colors */
typedef struct gs_client_color_s gs_client_color;

struct gs_client_color_s {
    gs_pattern_instance_t *pattern;
    gs_paint_color paint;	/* also color for uncolored pattern */
    /* CAUTION: gs_paint_color structure must be the last field in
       gs_client_color_s to allow allocating a smaller space when
       a small number of color components is in use.
    */
};

extern_st(st_client_color);
#define public_st_client_color() /* in gscolor.c */\
  gs_public_st_ptrs1(st_client_color, gs_client_color, "gs_client_color",\
    client_color_enum_ptrs, client_color_reloc_ptrs, pattern)
#define st_client_color_max_ptrs 1

/* Define the color space for a transparency */
/* Used to keep track of parent versus child */
/* color space changes with Smask and for */
/* blending */
typedef enum {
    GRAY_SCALE,
    DEVICE_RGB,
    DEVICE_CMYK,
    CIE_XYZ,
    DEVICEN,
    ICC,
    UNKNOWN,
    OTHER
} gs_transparency_color_t;


/*
 * Color model component polarity. An "unknown" value has been added to
 * this enumeration.  This is used for devices and color spaces.
 */
typedef enum {
    GX_CINFO_POLARITY_UNKNOWN = -1,
    GX_CINFO_POLARITY_SUBTRACTIVE = 0,
    GX_CINFO_POLARITY_ADDITIVE
} gx_color_polarity_t;

#endif /* gsccolor_INCLUDED */