11
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/*$Id: gxdcolor.h 8022 2007-06-05 22:23:38Z giles $ */
14
/*$Id: gxdcolor.h 8655 2008-04-21 14:53:38Z leonardo $ */
15
15
/* Device color representation for Ghostscript */
17
17
#ifndef gxdcolor_INCLUDED
150
150
* Serialize and deserialize a device color.
152
* The "write" routine converts a device color into a string for
152
* The "write" routine converts a device color into a stream for
153
153
* writing to the command list. *psize is the amount of space
154
154
* available. If the saved color and the current color are the same,
155
155
* the routine sets *psize to 0 and returns 1. Otherwise, if *psize
156
156
* is large enough, the procedure sets *psize to the amount actually
157
* used and returns 0. If *psize is too small and no other problem
157
* used and returns 0. If *psize is zero and no other problem
158
158
* is detected, *psize is set to the amount required and
159
* gs_error_rangecheck is returned. If some other error is detected,
160
* *psize is left unchanged and the error code is returned.
159
* gs_error_rangecheck is returned. If *psize is not zero,
160
* a data block is written into the buffer, and the function returns 0.
161
* Note the function always fills entire buffer of *psize length,
162
* except for the last block of the stream, which is written until
163
* the stream end. If some other error is detected, *psize is left unchanged
164
* and the error code is returned. When *psize is not zero,
165
* the offset operand specifies the position of the block in the stream.
162
* The "read" routine converts the string representation back into
167
* The "read" routine converts the stream representation back into
163
168
* the full device color structure. The value returned is the number
164
169
* of bytes actually read, or < 0 in the event of an error.
170
* The offset operand specifies the position of the block in the stream.
171
* If the returned block length is smaller than *psize,
172
* then there is no more data in the stream.
166
174
* As with any instance of virtual serialization, the command list
167
175
* code must include its own identifier of the color space type in
190
198
* changed, so informaition from the prior device color will no
191
199
* longer be available.
193
* For the read and method, the imager state is passed as an operand,
201
* For the read method, the imager state is passed as an operand,
194
202
* which allows the routine to access the current device halftone
195
203
* (always required). Also passed in a pointer to the existing device
196
204
* color, as this is not part of the imager state. If the writer was
208
216
#define dev_color_proc_write(proc)\
209
217
int proc(const gx_device_color *pdevc, const gx_device_color_saved *psdc,\
210
const gx_device * dev, byte *data, uint *psize)
218
const gx_device * dev, uint offset, byte *data, uint *psize)
211
219
dev_color_proc_write((*write));
213
221
#define dev_color_proc_read(proc)\
214
222
int proc(gx_device_color *pdevc, const gs_imager_state * pis,\
215
const gx_device_color *prior_devc, const gx_device * dev,\
223
const gx_device_color *prior_devc, const gx_device * dev, uint offset,\
216
224
const byte *data, uint size, gs_memory_t *mem)
217
225
dev_color_proc_read((*read));
244
252
/* Define the default implementation of fill_masked. */
245
253
dev_color_proc_fill_masked(gx_dc_default_fill_masked);
255
extern dev_color_proc_write(gx_dc_cannot_write);
256
extern dev_color_proc_read(gx_dc_cannot_read);
247
258
extern_st(st_device_color);
248
259
/* public_st_device_color() is defined in gsdcolor.h */