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

« back to all changes in this revision

Viewing changes to base/gxiparam.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: gxiparam.h 8803 2008-06-24 14:16:29Z leonardo $ */
 
15
/* Definitions for implementors of image types */
 
16
 
 
17
#ifndef gxiparam_INCLUDED
 
18
#  define gxiparam_INCLUDED
 
19
 
 
20
#include "gsstype.h"            /* for extern_st */
 
21
#include "gxdevcli.h"
 
22
 
 
23
/* ---------------- Image types ---------------- */
 
24
 
 
25
/* Define the structure for image types. */
 
26
 
 
27
#ifndef stream_DEFINED
 
28
#  define stream_DEFINED
 
29
typedef struct stream_s stream;
 
30
#endif
 
31
 
 
32
#ifndef gx_image_type_DEFINED
 
33
#  define gx_image_type_DEFINED
 
34
typedef struct gx_image_type_s gx_image_type_t;
 
35
#endif
 
36
 
 
37
struct gx_image_type_s {
 
38
 
 
39
    /*
 
40
     * Define the storage type for this type of image.
 
41
     */
 
42
    gs_memory_type_ptr_t stype;
 
43
 
 
44
    /*
 
45
     * Provide the default implementation of begin_typed_image for this
 
46
     * type.
 
47
     */
 
48
    dev_proc_begin_typed_image((*begin_typed_image));
 
49
 
 
50
    /*
 
51
     * Compute the width and height of the source data.  For images with
 
52
     * explicit data, this information is in the gs_data_image_t
 
53
     * structure, but ImageType 2 images must compute it.
 
54
     */
 
55
#define image_proc_source_size(proc)\
 
56
  int proc(const gs_imager_state *pis, const gs_image_common_t *pic,\
 
57
    gs_int_point *psize)
 
58
 
 
59
    image_proc_source_size((*source_size));
 
60
 
 
61
    /*
 
62
     * Put image parameters on a stream.  Currently this is used
 
63
     * only for banding.  If the parameters include a color space,
 
64
     * store it in *ppcs.
 
65
     */
 
66
#define image_proc_sput(proc)\
 
67
  int proc(const gs_image_common_t *pic, stream *s,\
 
68
    const gs_color_space **ppcs)
 
69
 
 
70
    image_proc_sput((*sput));
 
71
 
 
72
    /*
 
73
     * Get image parameters from a stream.  Currently this is used
 
74
     * only for banding.  If the parameters include a color space,
 
75
     * use pcs.
 
76
     */
 
77
#define image_proc_sget(proc)\
 
78
  int proc(gs_image_common_t *pic, stream *s, gs_color_space *pcs)
 
79
 
 
80
    image_proc_sget((*sget));
 
81
 
 
82
    /*
 
83
     * Release any parameters allocated by sget.
 
84
     * Currently this only frees the parameter structure itself.
 
85
     */
 
86
#define image_proc_release(proc)\
 
87
  void proc(gs_image_common_t *pic, gs_memory_t *mem)
 
88
 
 
89
    image_proc_release((*release));
 
90
 
 
91
    /*
 
92
     * We put index last so that if we add more procedures and some
 
93
     * implementor fails to initialize them, we'll get a type error.
 
94
     */
 
95
    int index;          /* PostScript ImageType */
 
96
};
 
97
 
 
98
/*
 
99
 * Define the procedure for getting the source size of an image with
 
100
 * explicit data.
 
101
 */
 
102
image_proc_source_size(gx_data_image_source_size);
 
103
/*
 
104
 * Define dummy sput/sget/release procedures for image types that don't
 
105
 * implement these functions.
 
106
 */
 
107
image_proc_sput(gx_image_no_sput); /* rangecheck error */
 
108
image_proc_sget(gx_image_no_sget); /* rangecheck error */
 
109
image_proc_release(gx_image_default_release); /* just free the params */
 
110
/*
 
111
 * Define sput/sget/release procedures for generic pixel images.
 
112
 * Note that these procedures take different parameters.
 
113
 */
 
114
int gx_pixel_image_sput(const gs_pixel_image_t *pic, stream *s,
 
115
                        const gs_color_space **ppcs, int extra);
 
116
int gx_pixel_image_sget(gs_pixel_image_t *pic, stream *s,
 
117
                        gs_color_space *pcs);
 
118
void gx_pixel_image_release(gs_pixel_image_t *pic, gs_memory_t *mem);
 
119
 
 
120
/* Internal procedures for use in sput/sget implementations. */
 
121
bool gx_image_matrix_is_default(const gs_data_image_t *pid);
 
122
void gx_image_matrix_set_default(gs_data_image_t *pid);
 
123
void sput_variable_uint(stream *s, uint w);
 
124
int sget_variable_uint(stream *s, uint *pw);
 
125
#define DECODE_DEFAULT(i, dd1)\
 
126
  ((i) == 1 ? dd1 : (i) & 1)
 
127
 
 
128
/* ---------------- Image enumerators ---------------- */
 
129
 
 
130
#ifndef gx_image_enum_common_t_DEFINED
 
131
#  define gx_image_enum_common_t_DEFINED
 
132
typedef struct gx_image_enum_common_s gx_image_enum_common_t;
 
133
#endif
 
134
 
 
135
/*
 
136
 * Define the procedures associated with an image enumerator.
 
137
 */
 
138
typedef struct gx_image_enum_procs_s {
 
139
 
 
140
    /*
 
141
     * Pass the next batch of data for processing.  *rows_used is set
 
142
     * even in the case of an error.
 
143
     */
 
144
 
 
145
#define image_enum_proc_plane_data(proc)\
 
146
  int proc(gx_image_enum_common_t *info, const gx_image_plane_t *planes,\
 
147
           int height, int *rows_used)
 
148
 
 
149
    image_enum_proc_plane_data((*plane_data));
 
150
 
 
151
    /*
 
152
     * End processing an image, freeing the enumerator.  We keep this
 
153
     * procedure as the last required one, so that we can detect obsolete
 
154
     * static initializers.
 
155
     */
 
156
 
 
157
#define image_enum_proc_end_image(proc)\
 
158
  int proc(gx_image_enum_common_t *info, bool draw_last)
 
159
 
 
160
    image_enum_proc_end_image((*end_image));
 
161
 
 
162
    /*
 
163
     * Flush any intermediate buffers to the target device.
 
164
     * We need this for situations where two images interact
 
165
     * (currently, only the mask and the data of ImageType 3).
 
166
     *
 
167
     * This procedure is optional (may be 0).
 
168
     */
 
169
 
 
170
#define image_enum_proc_flush(proc)\
 
171
  int proc(gx_image_enum_common_t *info)
 
172
 
 
173
    image_enum_proc_flush((*flush));
 
174
 
 
175
    /*
 
176
     * Determine which data planes should be passed on the next call to the
 
177
     * plane_data procedure, by filling wanted[0 .. num_planes - 1] with 0
 
178
     * for unwanted planes and non-0 for wanted planes.  This procedure may
 
179
     * also change the plane_depths[] and/or plane_widths[] values.  The
 
180
     * procedure returns true if the returned vector will always be the same
 
181
     * *and* the plane depths and widths remain constant, false if the
 
182
     * wanted planes *or* plane depths or widths may vary over the course of
 
183
     * the image.  Note also that the only time a plane's status can change
 
184
     * from wanted to not wanted, and the only time a wanted plane's depth
 
185
     * or width can change, is after a call of plane_data that actually
 
186
     * provides data for that plane.
 
187
     *
 
188
     * By default, all data planes are always wanted; however, ImageType 3
 
189
     * images with separate mask and image data sources may want mask data
 
190
     * before image data or vice versa.
 
191
     * 
 
192
     * This procedure is optional (may be 0).
 
193
     */
 
194
 
 
195
#define image_enum_proc_planes_wanted(proc)\
 
196
  bool proc(const gx_image_enum_common_t *info, byte *wanted)
 
197
 
 
198
    image_enum_proc_planes_wanted((*planes_wanted));
 
199
 
 
200
} gx_image_enum_procs_t;
 
201
 
 
202
/*
 
203
 * Define the common prefix of the image enumerator structure.  All
 
204
 * implementations of begin[_typed]_image must initialize all of the members
 
205
 * of this structure, by calling gx_image_enum_common_init and then filling
 
206
 * in whatever else they need to.
 
207
 *
 
208
 * Note that the structure includes a unique ID, so that the banding
 
209
 * machinery could in principle keep track of multiple enumerations that may
 
210
 * be in progress simultaneously.
 
211
 */
 
212
#define gx_image_enum_common\
 
213
        const gx_image_type_t *image_type;\
 
214
        const gx_image_enum_procs_t *procs;\
 
215
        gx_device *dev;\
 
216
        gs_memory_t *memory;    /* from begin_image */\
 
217
        gs_id id;\
 
218
        bool skipping; /* don't render, just consume image streams. */\
 
219
        int num_planes;\
 
220
        int plane_depths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\
 
221
        int plane_widths[GS_IMAGE_MAX_COMPONENTS]  /* [num_planes] */
 
222
struct gx_image_enum_common_s {
 
223
    gx_image_enum_common;
 
224
};
 
225
 
 
226
extern_st(st_gx_image_enum_common);
 
227
#define public_st_gx_image_enum_common()        /* in gdevddrw.c */\
 
228
  gs_public_st_composite(st_gx_image_enum_common, gx_image_enum_common_t,\
 
229
    "gx_image_enum_common_t",\
 
230
     image_enum_common_enum_ptrs, image_enum_common_reloc_ptrs)
 
231
 
 
232
/*
 
233
 * Initialize the common part of an image enumerator.
 
234
 */
 
235
int gx_image_enum_common_init(gx_image_enum_common_t * piec,
 
236
                              const gs_data_image_t * pic,
 
237
                              const gx_image_enum_procs_t * piep,
 
238
                              gx_device * dev, int num_components,
 
239
                              gs_image_format_t format);
 
240
 
 
241
/*
 
242
 * Define image_plane_data and end_image procedures for image types that
 
243
 * don't have any source data (ImageType 2 and composite images).
 
244
 */
 
245
image_enum_proc_plane_data(gx_no_plane_data);
 
246
image_enum_proc_end_image(gx_ignore_end_image);
 
247
/*
 
248
 * Define the procedures and type data for ImageType 1 images,
 
249
 * which are always included and which are shared with ImageType 4.
 
250
 */
 
251
dev_proc_begin_typed_image(gx_begin_image1);
 
252
image_enum_proc_plane_data(gx_image1_plane_data);
 
253
image_enum_proc_end_image(gx_image1_end_image);
 
254
image_enum_proc_flush(gx_image1_flush);
 
255
 
 
256
/* Free the image enumerator. */
 
257
void gx_image_free_enum(gx_image_enum_common_t **ppenum);
 
258
 
 
259
#endif /* gxiparam_INCLUDED */