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

« back to all changes in this revision

Viewing changes to src/gdevpsds.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: gdevpsds.h 8022 2007-06-05 22:23:38Z giles $ */
15
 
/* Image processing stream interface for PostScript and PDF writers */
16
 
 
17
 
#ifndef gdevpsds_INCLUDED
18
 
#  define gdevpsds_INCLUDED
19
 
 
20
 
#include "strimpl.h"
21
 
#include "gsiparam.h"
22
 
 
23
 
/* ---------------- Depth conversion ---------------- */
24
 
 
25
 
/* Convert between 1/2/4/12 bits and 8 bits. */
26
 
typedef struct stream_1248_state_s {
27
 
    stream_state_common;
28
 
    /* The following are set at initialization time. */
29
 
    uint samples_per_row;       /* >0 */
30
 
    int bits_per_sample;        /* 1, 2, 4, 12 */
31
 
    /* The following are updated dynamically. */
32
 
    uint left;                  /* # of samples left in current row */
33
 
} stream_1248_state;
34
 
 
35
 
/* Convert N (1, 2, 4, 12) bits to 8. */
36
 
extern const stream_template s_1_8_template;
37
 
extern const stream_template s_2_8_template;
38
 
extern const stream_template s_4_8_template;
39
 
extern const stream_template s_12_8_template;
40
 
 
41
 
/* Reduce 8 bits to N (1, 2, 4). */
42
 
/* We do not currently support converting 8 bits to 12. */
43
 
extern const stream_template s_8_1_template;
44
 
extern const stream_template s_8_2_template;
45
 
extern const stream_template s_8_4_template;
46
 
 
47
 
/* Initialize an expansion or reduction stream. */
48
 
int s_1248_init(stream_1248_state *ss, int Columns, int samples_per_pixel);
49
 
 
50
 
/* ---------------- Color space conversion ---------------- */
51
 
 
52
 
/* Convert (8-bit) CMYK to RGB. */
53
 
typedef struct stream_C2R_state_s {
54
 
    stream_state_common;
55
 
    /* The following are set at initialization time. */
56
 
    const gs_imager_state *pis; /* for UCR & BG */
57
 
} stream_C2R_state;
58
 
 
59
 
#define private_st_C2R_state()  /* in gdevpsds.c */\
60
 
  gs_private_st_ptrs1(st_C2R_state, stream_C2R_state, "stream_C2R_state",\
61
 
    c2r_enum_ptrs, c2r_reloc_ptrs, pis)
62
 
extern const stream_template s_C2R_template;
63
 
 
64
 
/* Initialize a CMYK => RGB conversion stream. */
65
 
int s_C2R_init(stream_C2R_state *ss, const gs_imager_state *pis);
66
 
 
67
 
/* Convert an image to indexed form (IndexedEncode filter). */
68
 
typedef struct stream_IE_state_s {
69
 
    stream_state_common;
70
 
    /* The client sets the following before initializing the stream. */
71
 
    int BitsPerComponent;       /* 1, 2, 4, 8 */
72
 
    int NumComponents;
73
 
    int Width;                  /* pixels per scan line, > 0 */
74
 
    int BitsPerIndex;           /* 1, 2, 4, 8 */
75
 
    /*
76
 
     * Note: this is not quite the same as the Decode array for images:
77
 
     * [0..1] designates the range of the corresponding component of the
78
 
     * color space, not the literal values 0..1.  This is the same for
79
 
     * all color spaces except Lab, where the default values here are
80
 
     * [0 1 0 1 0 1] rather than [0 100 amin amax bmin bmax].
81
 
     */
82
 
    const float *Decode;
83
 
    /*
84
 
     * The client must provide a Table whose size is at least
85
 
     * ((1 << BitsPerIndex) + 1) * NumComponents.  After the stream is
86
 
     * closed, the first (N + 1) * NumComponents bytes of the Table
87
 
     * will hold the palette, where N is the contents of the last byte of
88
 
     * the Table.
89
 
     */
90
 
    gs_bytestring Table;
91
 
    /* The following change dynamically. */
92
 
    int hash_table[400];        /* holds byte offsets in Table */
93
 
    int next_index;             /* next Table offset to assign */
94
 
    uint byte_in;
95
 
    int in_bits_left;
96
 
    int next_component;
97
 
    uint byte_out;
98
 
    int x;
99
 
} stream_IE_state;
100
 
 
101
 
#define private_st_IE_state()   /* in gdevpsds.c */\
102
 
  gs_public_st_composite(st_IE_state, stream_IE_state, "stream_IE_state",\
103
 
    ie_state_enum_ptrs, ie_state_reloc_ptrs)
104
 
 
105
 
extern const stream_template s_IE_template;
106
 
 
107
 
/* ---------------- Downsampling ---------------- */
108
 
 
109
 
/* Downsample, possibly with anti-aliasing. */
110
 
#define stream_Downsample_state_common\
111
 
        stream_state_common;\
112
 
                /* The client sets the following before initialization. */\
113
 
        int Colors;\
114
 
        int WidthIn, HeightIn;\
115
 
        int XFactor, YFactor;\
116
 
        bool AntiAlias;\
117
 
        bool padX, padY;        /* keep excess samples */\
118
 
                /* The following are updated dynamically. */\
119
 
        int x, y                /* position within input image */
120
 
#define s_Downsample_set_defaults_inline(ss)\
121
 
  ((ss)->AntiAlias = (ss)->padX = (ss)->padY = false)
122
 
typedef struct stream_Downsample_state_s {
123
 
    stream_Downsample_state_common;
124
 
} stream_Downsample_state;
125
 
 
126
 
/* Return the number of samples after downsampling. */
127
 
int s_Downsample_size_out(int size_in, int factor, bool pad);
128
 
 
129
 
/* Subsample */
130
 
typedef struct stream_Subsample_state_s {
131
 
    stream_Downsample_state_common;
132
 
} stream_Subsample_state;
133
 
extern const stream_template s_Subsample_template;
134
 
 
135
 
/* Average */
136
 
typedef struct stream_Average_state_s {
137
 
    stream_Downsample_state_common;
138
 
    uint sum_size;
139
 
    uint copy_size;
140
 
    uint *sums;                 /* accumulated sums for average */
141
 
} stream_Average_state;
142
 
 
143
 
#define private_st_Average_state()      /* in gdevpsds.c */\
144
 
  gs_private_st_ptrs1(st_Average_state, stream_Average_state,\
145
 
    "stream_Average_state", avg_enum_ptrs, avg_reloc_ptrs, sums)
146
 
extern const stream_template s_Average_template;
147
 
 
148
 
/* ---------------- Image compression chooser ---------------- */
149
 
 
150
 
typedef struct stream_compr_chooser_state_s {
151
 
    stream_state_common;
152
 
    uint choice;
153
 
    uint width, height, depth, bits_per_sample;
154
 
    uint samples_count, bits_left;
155
 
    ulong packed_data;
156
 
    byte *sample;
157
 
    ulong upper_plateaus, lower_plateaus;
158
 
    ulong gradients;
159
 
} stream_compr_chooser_state;
160
 
 
161
 
#define private_st_compr_chooser_state()        /* in gdevpsds.c */\
162
 
  gs_private_st_ptrs1(st_compr_chooser_state, stream_compr_chooser_state, \
163
 
    "stream_compr_chooser_state",\
164
 
    compr_chooser_enum_ptrs, compr_chooser_reloc_ptrs, sample)
165
 
 
166
 
extern const stream_template s_compr_chooser_template;
167
 
 
168
 
/* Set image dimensions. */
169
 
int
170
 
s_compr_chooser_set_dimensions(stream_compr_chooser_state * st, int width, 
171
 
                               int height, int depth, int bits_per_sample);
172
 
 
173
 
/* Get choice */
174
 
uint s_compr_chooser__get_choice(stream_compr_chooser_state *st, bool force);
175
 
 
176
 
/* ---------------- Am image color conversion filter ---------------- */
177
 
 
178
 
#ifndef gx_device_DEFINED
179
 
#  define gx_device_DEFINED
180
 
typedef struct gx_device_s gx_device;
181
 
#endif
182
 
 
183
 
typedef struct stream_image_colors_state_s stream_image_colors_state;
184
 
 
185
 
struct stream_image_colors_state_s {
186
 
    stream_state_common;
187
 
    uint width, height, depth, bits_per_sample;
188
 
    byte output_bits_buffer;
189
 
    uint output_bits_buffered;
190
 
    uint output_component_bits_written;
191
 
    uint output_component_index;
192
 
    uint output_depth, output_bits_per_sample;
193
 
    uint raster;
194
 
    uint row_bits;
195
 
    uint row_bits_passed;
196
 
    uint row_alignment_bytes;
197
 
    uint row_alignment_bytes_left;
198
 
    uint input_component_index;
199
 
    uint input_bits_buffer;
200
 
    uint input_bits_buffered;
201
 
    uint input_color[GS_IMAGE_MAX_COLOR_COMPONENTS];
202
 
    uint output_color[GS_IMAGE_MAX_COLOR_COMPONENTS];
203
 
    uint MaskColor[GS_IMAGE_MAX_COLOR_COMPONENTS * 2];
204
 
    float Decode[GS_IMAGE_MAX_COLOR_COMPONENTS * 2];
205
 
    const gs_color_space *pcs;
206
 
    gx_device *pdev;
207
 
    const gs_imager_state *pis;
208
 
    int (*convert_color)(stream_image_colors_state *);
209
 
};
210
 
 
211
 
#define private_st_image_colors_state() /* in gdevpsds.c */\
212
 
  gs_private_st_ptrs3(st_stream_image_colors_state, stream_image_colors_state,\
213
 
    "stream_image_colors_state", stream_image_colors_enum_ptrs,\
214
 
    stream_image_colors_reloc_ptrs, pcs, pdev, pis)
215
 
 
216
 
extern const stream_template s_image_colors_template;
217
 
 
218
 
void s_image_colors_set_dimensions(stream_image_colors_state * st, 
219
 
                               int width, int height, int depth, int bits_per_sample);
220
 
 
221
 
void s_image_colors_set_mask_colors(stream_image_colors_state * ss, uint *MaskColor);
222
 
 
223
 
void s_image_colors_set_color_space(stream_image_colors_state * ss, gx_device *pdev,
224
 
                               const gs_color_space *pcs, const gs_imager_state *pis,
225
 
                               float *Decode);
226
 
 
227
 
extern const stream_template s__image_colors_template;
228
 
 
229
 
#endif /* gdevpsds_INCLUDED */