1
/* Copyright (C) 2001-2007 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
13
/* $Id: gsnamecl.h 8764 2008-05-21 18:27:42Z mvrhel $ */
14
/* Global definitions for the 'Named Color' callback handling. */
16
#ifndef gsnamecl_INCLUDED
17
# define gsnamecl_INCLUDED
25
* Enable custom client callback color processing. Note: There is a sample
26
* implementation in src/gsncdummy.c.
28
#ifndef ENABLE_CUSTOM_COLOR_CALLBACK
29
#define ENABLE_CUSTOM_COLOR_CALLBACK 0 /* 0 --> disabled, 1 --> enabled */
32
#if ENABLE_CUSTOM_COLOR_CALLBACK
33
/* Ptr to custom color callback struct */
34
#define CUSTOM_COLOR_PTR void * custom_color_callback;
35
#define INIT_CUSTOM_COLOR_PTR NULL, /* Initial value */
37
#define CUSTOM_COLOR_PTR
38
#define INIT_CUSTOM_COLOR_PTR
41
#define CustomColorCallbackParamName "CustomColorCallback"
44
* For comments upon the client API for working with the custom client
45
* callback logic see the section labeled: "CLIENT COLOR CALLBACK
46
* APPLICATION INTERFACE" below.
48
* Also see the comments at the start of src/gsnamecl.c
51
#ifndef gs_color_space_DEFINED
52
# define gs_color_space_DEFINED
53
typedef struct gs_color_space_s gs_color_space;
56
#ifndef gx_device_color_DEFINED
57
# define gx_device_color_DEFINED
58
typedef struct gx_device_color_s gx_device_color;
61
#ifndef gs_state_DEFINED
62
# define gs_state_DEFINED
63
typedef struct gs_state_s gs_state;
66
#ifndef gs_imager_state_DEFINED
67
# define gs_imager_state_DEFINED
68
typedef struct gs_imager_state_s gs_imager_state;
71
#ifndef gx_device_DEFINED
72
# define gx_device_DEFINED
73
typedef struct gx_device_s gx_device;
76
#ifndef i_ctx_t_DEFINED
77
#define i_ctx_t_DEFINED
78
typedef struct gs_context_state_s i_ctx_t;
81
/* Define an opaque type for parameter lists. */
82
#ifndef gs_param_list_DEFINED
83
# define gs_param_list_DEFINED
84
typedef struct gs_param_list_s gs_param_list;
87
#define cs_proc_adjust_client_cspace_count(proc)\
88
void proc(const gs_color_space *, int)
91
* Put the 'custom color' client callback parameter block pointer. This value
92
* is passed as a string type user paramter. A string is being used since
93
* PostScript does not support pointers as a type. Note: An integer type
94
* is not being used since PS integers are nominally 32 bits. Thus there
95
* would be a problem using integers to pass pointer values on 64 bit systems.
97
int custom_color_callback_put_params(gs_state * pgs, gs_param_list * plist);
100
* Get the custom client client callback parameter block pointer. This value
101
* is passed as a string type user paramter. A string is being used since
102
* PostScript does not support pointers as a type. Note: An integer type
103
* is not being used since PS intergers are nominally 32 bits. Thus there
104
* would be a problem using integers to pass pointer values on 64 bit systems.
106
int custom_color_callback_get_params(gs_state * pgs, gs_param_list * plist);
109
* Check if we want to use the callback color processing logic for the given
110
* Separation color space.
112
bool custom_color_callback_install_Separation(gs_color_space * pcs,
116
* Check if we want to use the custom client callback processing logic for the
117
* given DeviceN color space.
119
bool custom_color_callback_install_DeviceN(gs_color_space * pcs, gs_state * pgs);
122
* Convert a Separation color into device colorants using the custom client
125
int gx_remap_concrete_custom_color_Separation(const frac * pconc,
126
const gs_color_space * pcs, gx_device_color * pdc,
127
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
130
* Convert a DeviceN color into device colorants using the custom client
133
int gx_remap_concrete_custom_color_DeviceN(const frac * pconc,
134
const gs_color_space * pcs, gx_device_color * pdc,
135
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
137
/* "CLIENT COLOR CALLBACK APPLICATION INTERFACE" */
139
* In order to give some flexibility to the Ghostscript client API, we are
140
* allowing the client to define a set of call back procedures for processing
143
* See the comments at the start of src/gsnamecl.c
146
* The 'client color' call back structure definitions. The call back structure
147
* consists of a pointer to a list of client color space handling procedures
148
* and a pointer to a client data structure.
151
#ifndef client_custom_color_params_DEFINED
152
#define client_custom_color_params_DEFINED
153
typedef struct client_custom_color_params_s {
154
/* Client callback handlers */
155
struct client_custom_color_procs_s * client_procs;
156
/* For global client data */
158
} client_custom_color_params_t;
163
* Define a base type for client color space data. Most clients will
164
* overload this type with a structure of their own. That type must
165
* start with a pointer to a handler routine for the structure's
168
typedef struct client_color_space_data_s {
169
cs_proc_adjust_client_cspace_count((*client_adjust_cspace_count));
170
} client_color_space__data_t;
173
* Define the client custom client callback procedures.
175
typedef struct client_custom_color_procs_s {
177
* Install a DeviceGray color space.
179
bool (* install_DeviceGray)(client_custom_color_params_t * pparams,
180
gs_color_space * pcs, gs_state * pgs);
182
* Convert a DeviceGray color into device color.
184
int (* remap_DeviceGray)(client_custom_color_params_t * pparams,
185
const frac * pconc, const gs_color_space * pcs,
186
gx_device_color * pdc, const gs_imager_state * pis,
187
gx_device * dev, gs_color_select_t select);
189
* Install a DeviceRGB color space.
191
bool (* install_DeviceRGB)(client_custom_color_params_t * pparams,
192
gs_color_space * pcs, gs_state * pgs);
194
* Convert a DeviceRGB color into device color.
196
int (* remap_DeviceRGB)(client_custom_color_params_t * pparams,
197
const frac * pconc, const gs_color_space * pcs,
198
gx_device_color * pdc, const gs_imager_state * pis,
199
gx_device * dev, gs_color_select_t select);
201
* Install a DeviceCMYK color space.
203
bool (* install_DeviceCMYK)(client_custom_color_params_t * pparams,
204
gs_color_space * pcs, gs_state * pgs);
206
* Convert a DeviceGray color into device color.
208
int (* remap_DeviceCMYK)(client_custom_color_params_t * pparams,
209
const frac * pconc, const gs_color_space * pcs,
210
gx_device_color * pdc, const gs_imager_state * pis,
211
gx_device * dev, gs_color_select_t select);
213
* Check if we want to use the callback color processing logic for the
214
* given Separation color space.
216
bool (* install_Separation)(client_custom_color_params_t * pparams,
217
gs_color_space * pcs, gs_state * pgs);
219
* Convert a Separation color into device color.
221
int (* remap_Separation)(client_custom_color_params_t * pparams,
222
const frac * pconc, const gs_color_space * pcs,
223
gx_device_color * pdc, const gs_imager_state * pis,
224
gx_device * dev, gs_color_select_t select);
226
* Check if we want to use the callback color processing logic for the
227
* given DeviceN color space.
229
bool (* install_DeviceN)(client_custom_color_params_t * pparams,
230
gs_color_space * pcs, gs_state * pgs);
232
* Convert a DeviceN color into device color.
234
int (* remap_DeviceN)(client_custom_color_params_t * pparams,
235
const frac * pconc, const gs_color_space * pcs,
236
gx_device_color * pdc, const gs_imager_state * pis,
237
gx_device * dev, gs_color_select_t select);
239
* Check if we want to use the callback color processing logic for the
240
* given CIEBasedA color space.
242
bool (* install_CIEBasedA)(client_custom_color_params_t * pparams,
243
gs_color_space * pcs, gs_state * pgs);
245
* Please note that the 'complex' color spaces (CIEBasedA, CIEBasedABC,
246
* CIEBasedDEF, CIEBasedDEFG, and ICCBased) have a different prototype,
247
* versus the simpler color spces, for the callback for converting a
251
* Convert a CIEBasedA color into device color.
253
int (* remap_CIEBasedA)(client_custom_color_params_t * pparams,
254
const gs_client_color * pc, const gs_color_space * pcs,
255
gx_device_color * pdc, const gs_imager_state * pis,
256
gx_device * dev, gs_color_select_t select);
258
* Check if we want to use the callback color processing logic for the
259
* given CIEBasedABC color space.
261
bool (* install_CIEBasedABC)(client_custom_color_params_t * pparams,
262
gs_color_space * pcs, gs_state * pgs);
264
* Convert a CIEBasedABC color into device color.
266
int (* remap_CIEBasedABC)(client_custom_color_params_t * pparams,
267
const gs_client_color * pc, const gs_color_space * pcs,
268
gx_device_color * pdc, const gs_imager_state * pis,
269
gx_device * dev, gs_color_select_t select);
271
* Check if we want to use the callback color processing logic for the
272
* given CIEBasedDEF color space.
274
bool (* install_CIEBasedDEF)(client_custom_color_params_t * pparams,
275
gs_color_space * pcs, gs_state * pgs);
277
* Convert a CIEBasedDEF color into device color.
279
int (* remap_CIEBasedDEF)(client_custom_color_params_t * pparams,
280
const gs_client_color * pc, const gs_color_space * pcs,
281
gx_device_color * pdc, const gs_imager_state * pis,
282
gx_device * dev, gs_color_select_t select);
284
* Check if we want to use the callback color processing logic for the
285
* given CIEBasedDEFG color space.
287
bool (* install_CIEBasedDEFG)(client_custom_color_params_t * pparams,
288
gs_color_space * pcs, gs_state * pgs);
290
* Convert a CIEBasedDEFG color into device color.
292
int (* remap_CIEBasedDEFG)(client_custom_color_params_t * pparams,
293
const gs_client_color * pc, const gs_color_space * pcs,
294
gx_device_color * pdc, const gs_imager_state * pis,
295
gx_device * dev, gs_color_select_t select);
297
* Check if we want to use the callback color processing logic for the
298
* given ICCBased color space.
300
bool (* install_ICCBased)(client_custom_color_params_t * pparams,
301
gs_color_space * pcs, gs_state * pgs);
303
* Convert a ICCBased color into device color.
305
int (* remap_ICCBased)(client_custom_color_params_t * pparams,
306
const gs_client_color * pc, const gs_color_space * pcs,
307
gx_device_color * pdc, const gs_imager_state * pis,
308
gx_device * dev, gs_color_select_t select);
310
} client_custom_color_procs_t;
312
#endif /* ifndef gsnamecl_INCLUDED */