~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to src/gxcmap.h

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2001-2006 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, 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.
12
 
*/
13
 
 
14
 
/* $Id: gxcmap.h 8422 2007-12-03 21:31:16Z henrys $ */
15
 
/* Color mapping procedures */
16
 
/* Requires gxdcolor.h. */
17
 
 
18
 
#ifndef gxcmap_INCLUDED
19
 
#  define gxcmap_INCLUDED
20
 
 
21
 
#include "gscsel.h"
22
 
#include "gxfmap.h"
23
 
 
24
 
#ifndef gx_device_DEFINED
25
 
#  define gx_device_DEFINED
26
 
typedef struct gx_device_s gx_device;
27
 
#endif
28
 
#ifndef gx_device_color_DEFINED
29
 
#  define gx_device_color_DEFINED
30
 
typedef struct gx_device_color_s gx_device_color;
31
 
#endif
32
 
 
33
 
/* Procedures for rendering colors specified by fractions. */
34
 
 
35
 
#define cmap_proc_gray(proc)\
36
 
  void proc(frac, gx_device_color *, const gs_imager_state *,\
37
 
            gx_device *, gs_color_select_t)
38
 
#define cmap_proc_rgb(proc)\
39
 
  void proc(frac, frac, frac, gx_device_color *, const gs_imager_state *,\
40
 
            gx_device *, gs_color_select_t)
41
 
#define cmap_proc_cmyk(proc)\
42
 
  void proc(frac, frac, frac, frac, gx_device_color *,\
43
 
            const gs_imager_state *, gx_device *, gs_color_select_t)
44
 
#define cmap_proc_rgb_alpha(proc)\
45
 
  void proc(frac, frac, frac, frac, gx_device_color *,\
46
 
               const gs_imager_state *, gx_device *, gs_color_select_t)
47
 
#define cmap_proc_separation(proc)\
48
 
  void proc(frac, gx_device_color *, const gs_imager_state *,\
49
 
               gx_device *, gs_color_select_t)
50
 
#define cmap_proc_devicen(proc)\
51
 
  void proc(const frac *, gx_device_color *, const gs_imager_state *, \
52
 
               gx_device *, gs_color_select_t)
53
 
#define cmap_proc_is_halftoned(proc)\
54
 
  bool proc(const gs_imager_state *, gx_device *)
55
 
 
56
 
/*
57
 
 * List of mapping functions from the standard color spaces to the
58
 
 * device color model. Any unused component will be mapped to 0.
59
 
 */
60
 
#define cm_map_proc_gray(proc) \
61
 
    void proc (gx_device * dev, frac gray, \
62
 
              frac * out)
63
 
 
64
 
#define cm_map_proc_rgb(proc) \
65
 
    void proc (gx_device * dev, \
66
 
              const gs_imager_state *pis, \
67
 
              frac r, frac g, frac b, \
68
 
              frac * out)
69
 
 
70
 
#define cm_map_proc_cmyk(proc) \
71
 
    void proc (gx_device * dev, \
72
 
              frac c, frac m, frac y, frac k, \
73
 
              frac * out)
74
 
 
75
 
/*
76
 
 * The following procedures come from the device.  It they are
77
 
 * specified then  they are used to convert from the given
78
 
 * color space to the device's color model.  Otherwise the
79
 
 * standard conversions are used.  The procedures must be defined
80
 
 * for a DeviceN color model
81
 
 *
82
 
 * Because of a bug in the Watcom C compiler, we have to split the
83
 
 * struct from the typedef.
84
 
 */
85
 
struct gx_cm_color_map_procs_s {
86
 
    cm_map_proc_gray((*map_gray));
87
 
    cm_map_proc_rgb((*map_rgb));
88
 
    cm_map_proc_cmyk((*map_cmyk));
89
 
};
90
 
 
91
 
typedef struct gx_cm_color_map_procs_s  gx_cm_color_map_procs;
92
 
 
93
 
/*
94
 
 * Make some routine global for use in the forwarding device.
95
 
 */
96
 
cm_map_proc_gray(gray_cs_to_gray_cm);
97
 
cm_map_proc_rgb(rgb_cs_to_rgb_cm);
98
 
cm_map_proc_cmyk(cmyk_cs_to_cmyk_cm);
99
 
 
100
 
/*
101
 
 * Color mapping may now be device specific, so the color space
102
 
 * to color model mapping is separated from other maps, such as
103
 
 * applying the current transfer function or halftone.
104
 
 *
105
 
 * The routine pointed to by get_cmap_procs (a field in the image
106
 
 * state; see gxistate.h) should initialize the cm_color_map_procs
107
 
 * pointer, using the get_color_mapping_procs method of the device.
108
 
 *
109
 
 * Because of a bug in the Watcom C compiler, we have to split the
110
 
 * struct from the typedef.
111
 
 */
112
 
struct gx_color_map_procs_s {
113
 
    cmap_proc_gray((*map_gray));
114
 
    cmap_proc_rgb((*map_rgb));
115
 
    cmap_proc_cmyk((*map_cmyk));
116
 
    cmap_proc_rgb_alpha((*map_rgb_alpha));
117
 
    cmap_proc_separation((*map_separation));
118
 
    cmap_proc_devicen((*map_devicen));
119
 
    cmap_proc_is_halftoned((*is_halftoned));
120
 
};
121
 
typedef struct gx_color_map_procs_s gx_color_map_procs;
122
 
 
123
 
/*
124
 
 * Determine the color mapping procedures for a device.  Even though this
125
 
 * does not currently use information from the imager state, it must be
126
 
 * a virtual procedure of the state for internal reasons.
127
 
 */
128
 
const gx_color_map_procs *
129
 
    gx_get_cmap_procs(const gs_imager_state *, const gx_device *);
130
 
const gx_color_map_procs *
131
 
    gx_default_get_cmap_procs(const gs_imager_state *, const gx_device *);
132
 
 
133
 
/*
134
 
 * Set the color mapping procedures in the graphics state.  This is
135
 
 * currently only needed when switching devices, but might be used more
136
 
 * often in the future.
137
 
 */
138
 
void gx_set_cmap_procs(gs_imager_state *, const gx_device *);
139
 
 
140
 
/* Remap a concrete (frac) gray, RGB or CMYK color. */
141
 
/* These cannot fail, and do not return a value. */
142
 
#define gx_remap_concrete_gray(cgray, pdc, pis, dev, select)\
143
 
  ((pis)->cmap_procs->map_gray)(cgray, pdc, pis, dev, select)
144
 
#define gx_remap_concrete_rgb(cr, cg, cb, pdc, pis, dev, select)\
145
 
  ((pis)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pis, dev, select)
146
 
#define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pis, dev, select)\
147
 
  ((pis)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pis, dev, select)
148
 
#define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pis, dev, select)\
149
 
  ((pis)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pis, dev, select)
150
 
#define gx_remap_concrete_separation(pcc, pdc, pis, dev, select)\
151
 
  ((pis)->cmap_procs->map_separation)(pcc, pdc, pis, dev, select)
152
 
#define gx_remap_concrete_devicen(pcc, pdc, pis, dev, select)\
153
 
  ((pis)->cmap_procs->map_devicen)(pcc, pdc, pis, dev, select)
154
 
 
155
 
/* Map a color */
156
 
#include "gxcindex.h"
157
 
#include "gxcvalue.h"
158
 
 
159
 
/*
160
 
 * These are the default routines for converting a color space into
161
 
 * a list of device colorants.
162
 
 */
163
 
extern cm_map_proc_gray(gx_default_gray_cs_to_gray_cm);
164
 
extern cm_map_proc_rgb(gx_default_rgb_cs_to_gray_cm);
165
 
extern cm_map_proc_cmyk(gx_default_cmyk_cs_to_gray_cm);
166
 
 
167
 
extern cm_map_proc_gray(gx_default_gray_cs_to_rgb_cm);
168
 
extern cm_map_proc_rgb(gx_default_rgb_cs_to_rgb_cm);
169
 
extern cm_map_proc_cmyk(gx_default_cmyk_cs_to_rgb_cm);
170
 
 
171
 
extern cm_map_proc_gray(gx_default_gray_cs_to_cmyk_cm);
172
 
extern cm_map_proc_rgb(gx_default_rgb_cs_to_cmyk_cm);
173
 
extern cm_map_proc_cmyk(gx_default_cmyk_cs_to_cmyk_cm);
174
 
 
175
 
extern cm_map_proc_gray(gx_default_gray_cs_to_cmyk_cm);
176
 
extern cm_map_proc_rgb(gx_default_rgb_cs_to_cmyk_cm);
177
 
extern cm_map_proc_cmyk(gx_default_cmyk_cs_to_cmyk_cm);
178
 
 
179
 
extern cm_map_proc_gray(gx_error_gray_cs_to_cmyk_cm);
180
 
extern cm_map_proc_rgb(gx_error_rgb_cs_to_cmyk_cm);
181
 
extern cm_map_proc_cmyk(gx_error_cmyk_cs_to_cmyk_cm);
182
 
 
183
 
 
184
 
/*
185
 
  Get the mapping procedures appropriate for the currently set
186
 
  color model.
187
 
 */
188
 
#define dev_t_proc_get_color_mapping_procs(proc, dev_t) \
189
 
    const gx_cm_color_map_procs * (proc)(const dev_t * dev)
190
 
 
191
 
#define dev_proc_get_color_mapping_procs(proc) \
192
 
    dev_t_proc_get_color_mapping_procs(proc, gx_device)
193
 
 
194
 
/*
195
 
  Define the options for the component_type parameter to get_color_comp_index
196
 
  routines.  Note:  This information is currently being used by the routines
197
 
  for identifying when they are being given a separation name.  Some devices
198
 
  automaticaly add separations to the device's components if the separation
199
 
  is not previously known and there is room in the device.
200
 
*/
201
 
#define NO_COMP_NAME_TYPE       0
202
 
#define SEPARATION_NAME         1
203
 
 
204
 
/*
205
 
  Convert a color component name into a colorant index.
206
 
*/
207
 
#define dev_t_proc_get_color_comp_index(proc, dev_t) \
208
 
    int (proc)(dev_t * dev, const char * pname, int name_size, int component_type)
209
 
 
210
 
#define dev_proc_get_color_comp_index(proc) \
211
 
    dev_t_proc_get_color_comp_index(proc, gx_device)
212
 
 
213
 
/*
214
 
  Map a color into the device's color model.
215
 
*/
216
 
#define dev_t_proc_encode_color(proc, dev_t) \
217
 
    gx_color_index (proc)(dev_t * dev, const gx_color_value colors[])
218
 
 
219
 
#define dev_proc_encode_color(proc) \
220
 
    dev_t_proc_encode_color(proc, gx_device)
221
 
 
222
 
/*
223
 
  Map a color index from the device's current color model into a list of
224
 
  colorant values.
225
 
*/
226
 
#define dev_t_proc_decode_color(proc, dev_t) \
227
 
    int (proc)(dev_t * dev, gx_color_index cindex, gx_color_value colors[])
228
 
 
229
 
#define dev_proc_decode_color(proc) \
230
 
    dev_t_proc_decode_color(proc, gx_device)
231
 
 
232
 
 
233
 
 
234
 
/*
235
 
 * These are the default routines for translating a color component
236
 
 * name into the device colorant index.
237
 
 */
238
 
dev_proc_get_color_comp_index(gx_error_get_color_comp_index);
239
 
dev_proc_get_color_comp_index(gx_default_DevGray_get_color_comp_index);
240
 
dev_proc_get_color_comp_index(gx_default_DevRGB_get_color_comp_index);
241
 
dev_proc_get_color_comp_index(gx_default_DevCMYK_get_color_comp_index);
242
 
dev_proc_get_color_comp_index(gx_default_DevRGBK_get_color_comp_index);
243
 
 
244
 
/*
245
 
 * These are the default routines for getting the color space conversion
246
 
 * routines.
247
 
 */
248
 
dev_proc_get_color_mapping_procs(gx_error_get_color_mapping_procs);
249
 
dev_proc_get_color_mapping_procs(gx_default_DevGray_get_color_mapping_procs);
250
 
dev_proc_get_color_mapping_procs(gx_default_DevRGB_get_color_mapping_procs);
251
 
dev_proc_get_color_mapping_procs(gx_default_DevCMYK_get_color_mapping_procs);
252
 
dev_proc_get_color_mapping_procs(gx_default_DevRGBK_get_color_mapping_procs);
253
 
 
254
 
/*
255
 
 * These are the default routines for converting a colorant value list
256
 
 * into a gx_color_index.
257
 
 */
258
 
dev_proc_encode_color(gx_error_encode_color);
259
 
dev_proc_encode_color(gx_default_encode_color);
260
 
 
261
 
/*
262
 
 * These are the default routines for converting a colorant value list
263
 
 * into a gx_color_index.
264
 
 */
265
 
dev_proc_encode_color(gx_default_gray_fast_encode);
266
 
dev_proc_encode_color(gx_default_gray_encode);
267
 
 
268
 
/*
269
 
 * This is the default encode_color routine for grayscale devices
270
 
 * that provide a map_rgb_color procedure, but don't themselves
271
 
 * provide encode_color.
272
 
 */
273
 
dev_proc_encode_color(gx_backwards_compatible_gray_encode);
274
 
 
275
 
/*
276
 
 * These are the default routines for converting a gx_color_index into
277
 
 * a list of device colorant values
278
 
 */
279
 
dev_proc_decode_color(gx_error_decode_color);
280
 
dev_proc_decode_color(gx_default_decode_color);
281
 
 
282
 
/*
283
 
 * convert a float paint value to a fractional value with clamping to
284
 
 * [0,1]
285
 
 */
286
 
frac gx_unit_frac(float fvalue);
287
 
 
288
 
#endif /* gxcmap_INCLUDED */