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

« back to all changes in this revision

Viewing changes to src/gxht.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: gxht.h 8022 2007-06-05 22:23:38Z giles $ */
15
 
/* Rest of (client) halftone definitions */
16
 
 
17
 
#ifndef gxht_INCLUDED
18
 
#  define gxht_INCLUDED
19
 
 
20
 
#include "gsht1.h"
21
 
#include "gsrefct.h"
22
 
#include "gxhttype.h"
23
 
#include "gxtmap.h"
24
 
#include "gscspace.h"
25
 
 
26
 
/*
27
 
 * Halftone types. Note that for this implementation there are only
28
 
 * spot functions, thresholds, and multi-component halftones; the peculiar
29
 
 * colored halftones supported by PostScript (HalftoneType's 2 and 4) are
30
 
 * not supported.
31
 
 *
32
 
 * NB1: While this code supports relocation of the client data, it will not
33
 
 *      free that data when the halftone is released. The client must handle
34
 
 *      that task directly.
35
 
 *
36
 
 * NB2: The garbage collection code will deal with the user provided data as
37
 
 *      a structure pointer allocated on the heap. The client must make
38
 
 *      certain this is the case.
39
 
 *
40
 
 * There is, somewhat unfortunately, no identifier applied to these
41
 
 * halftones. This reflects the origin of this graphics library as a set
42
 
 * of routines for use by a PostScript interpreter.
43
 
 *
44
 
 * In PostScript, halftone objects do not exist in an identified form outside
45
 
 * of the graphic state. Though Level 2 and PostScript 3 support halftone
46
 
 * dictionaries, these are neither read-only structures nor tagged
47
 
 * by a unique identifier. Hence, they are not suitable for use as cache keys.
48
 
 * Caching of halftones for PostScript is confined to the graphic state,
49
 
 * and this holds true for the graphic library as well.
50
 
 *
51
 
 * Note also that implementing a generalized halftone cache is not trivial,
52
 
 * as the device-specific representation of spot halftones depends on the 
53
 
 * default transformation for the device, and more generally the device
54
 
 * specific representation of halftones may depend on the sense of the device
55
 
 * (additive or subtract). Hence, a halftone cache would need to be keyed
56
 
 * by device. (This is not an issue when caching halftones in the graphic
57
 
 * state as the device is also a component of the graphic state).
58
 
 */
59
 
 
60
 
/*
61
 
 * Note that the transfer_closure members will replace transfer sometime
62
 
 * in the future.  For the moment, transfer_closure is only used if
63
 
 * transfer = 0.
64
 
 */
65
 
 
66
 
/* Type 1 halftone.  This is just a Level 1 halftone with */
67
 
/* a few extra members. */
68
 
typedef struct gs_spot_halftone_s {
69
 
    gs_screen_halftone screen;
70
 
    bool accurate_screens;
71
 
    gs_mapping_proc transfer;   /* OBSOLETE */
72
 
    gs_mapping_closure_t transfer_closure;
73
 
} gs_spot_halftone;
74
 
 
75
 
#define st_spot_halftone_max_ptrs st_screen_halftone_max_ptrs + 1
76
 
 
77
 
/* Define common elements for Type 3 and extended Type 3 halftones. */
78
 
#define GS_THRESHOLD_HALFTONE_COMMON\
79
 
    int width;\
80
 
    int height;\
81
 
    gs_mapping_closure_t transfer_closure
82
 
typedef struct gs_threshold_halftone_common_s {
83
 
    GS_THRESHOLD_HALFTONE_COMMON;
84
 
} gs_threshold_halftone_common;
85
 
 
86
 
/* Type 3 halftone. */
87
 
typedef struct gs_threshold_halftone_s {
88
 
    GS_THRESHOLD_HALFTONE_COMMON; /* must be first */
89
 
    gs_const_string thresholds;
90
 
    gs_mapping_proc transfer;   /* OBSOLETE */
91
 
} gs_threshold_halftone;
92
 
 
93
 
#define st_threshold_halftone_max_ptrs 2
94
 
 
95
 
/* Extended Type 3 halftone. */
96
 
typedef struct gs_threshold2_halftone_s {
97
 
    GS_THRESHOLD_HALFTONE_COMMON; /* must be first */
98
 
    int width2;
99
 
    int height2;
100
 
    int bytes_per_sample;       /* 1 or 2 */
101
 
    gs_const_bytestring thresholds; /* nota bene */
102
 
} gs_threshold2_halftone;
103
 
 
104
 
/* Client-defined halftone that generates a halftone order. */
105
 
typedef struct gs_client_order_halftone_s gs_client_order_halftone;
106
 
 
107
 
#ifndef gx_ht_order_DEFINED
108
 
#  define gx_ht_order_DEFINED
109
 
typedef struct gx_ht_order_s gx_ht_order;
110
 
#endif
111
 
typedef struct gs_client_order_ht_procs_s {
112
 
 
113
 
    /*
114
 
     * Allocate and fill in the order.  gx_ht_alloc_client_order
115
 
     * (see gzht.h) does everything but fill in the actual data.
116
 
     */
117
 
 
118
 
    int (*create_order) (gx_ht_order * porder,
119
 
                         gs_state * pgs,
120
 
                         const gs_client_order_halftone * phcop,
121
 
                         gs_memory_t * mem);
122
 
 
123
 
} gs_client_order_ht_procs_t;
124
 
struct gs_client_order_halftone_s {
125
 
    int width;
126
 
    int height;
127
 
    int num_levels;
128
 
    const gs_client_order_ht_procs_t *procs;
129
 
    const void *client_data;
130
 
    gs_mapping_closure_t transfer_closure;
131
 
};
132
 
 
133
 
#define st_client_order_halftone_max_ptrs 2
134
 
 
135
 
/* Define the elements of a Type 5 halftone. */
136
 
typedef struct gs_halftone_component_s {
137
 
    int comp_number;
138
 
    int cname;
139
 
    gs_halftone_type type;
140
 
    union {
141
 
        gs_spot_halftone spot;  /* Type 1 */
142
 
        gs_threshold_halftone threshold;        /* Type 3 */
143
 
        gs_threshold2_halftone threshold2;      /* Extended Type 3 */
144
 
        gs_client_order_halftone client_order;  /* client order */
145
 
    } params;
146
 
} gs_halftone_component;
147
 
 
148
 
extern_st(st_halftone_component);
149
 
#define public_st_halftone_component()  /* in gsht1.c */\
150
 
  gs_public_st_composite(st_halftone_component, gs_halftone_component,\
151
 
    "gs_halftone_component", halftone_component_enum_ptrs,\
152
 
    halftone_component_reloc_ptrs)
153
 
extern_st(st_ht_component_element);
154
 
#define public_st_ht_component_element() /* in gsht1.c */\
155
 
  gs_public_st_element(st_ht_component_element, gs_halftone_component,\
156
 
    "gs_halftone_component[]", ht_comp_elt_enum_ptrs, ht_comp_elt_reloc_ptrs,\
157
 
    st_halftone_component)
158
 
#define st_halftone_component_max_ptrs\
159
 
  max(max(st_spot_halftone_max_ptrs, st_threshold_halftone_max_ptrs),\
160
 
      st_client_order_halftone_max_ptrs)
161
 
 
162
 
/* Define the Type 5 halftone itself. */
163
 
typedef struct gs_multiple_halftone_s {
164
 
    gs_halftone_component *components;
165
 
    uint num_comp;
166
 
    int (*get_colorname_string)(const gs_memory_t *mem, gs_separation_name colorname_index,
167
 
                unsigned char **ppstr, unsigned int *pname_size);
168
 
} gs_multiple_halftone;
169
 
 
170
 
#define st_multiple_halftone_max_ptrs 1
171
 
 
172
 
/*
173
 
 * The halftone stored in the graphics state is the union of
174
 
 * setscreen, setcolorscreen, Type 1, Type 3, and Type 5.
175
 
 *
176
 
 * NOTE: it is assumed that all subsidiary structures of halftones (the
177
 
 * threshold array(s) for Type 3 halftones or halftone components, and the
178
 
 * components array for Type 5 halftones) are allocated with the same
179
 
 * allocator as the halftone structure itself.
180
 
 */
181
 
struct gs_halftone_s {
182
 
    gs_halftone_type type;
183
 
    rc_header rc;
184
 
    union {
185
 
        gs_screen_halftone screen;      /* setscreen */
186
 
        gs_colorscreen_halftone colorscreen;    /* setcolorscreen */
187
 
        gs_spot_halftone spot;  /* Type 1 */
188
 
        gs_threshold_halftone threshold;        /* Type 3 */
189
 
        gs_threshold2_halftone threshold2;      /* Extended Type 3 */
190
 
        gs_client_order_halftone client_order;  /* client order */
191
 
        gs_multiple_halftone multiple;  /* Type 5 */
192
 
    } params;
193
 
};
194
 
 
195
 
extern_st(st_halftone);
196
 
#define public_st_halftone()    /* in gsht.c */\
197
 
  gs_public_st_composite(st_halftone, gs_halftone, "gs_halftone",\
198
 
    halftone_enum_ptrs, halftone_reloc_ptrs)
199
 
#define st_halftone_max_ptrs\
200
 
  max(max(st_screen_halftone_max_ptrs, st_colorscreen_halftone_max_ptrs),\
201
 
      max(max(st_spot_halftone_max_ptrs, st_threshold_halftone_max_ptrs),\
202
 
          max(st_client_order_halftone_max_ptrs,\
203
 
              st_multiple_halftone_max_ptrs)))
204
 
 
205
 
/* Procedural interface for AccurateScreens */
206
 
 
207
 
/*
208
 
 * Set/get the default AccurateScreens value (for set[color]screen).
209
 
 * Note that this value is stored in a static variable.
210
 
 */
211
 
void gs_setaccuratescreens(bool);
212
 
bool gs_currentaccuratescreens(void);
213
 
 
214
 
/*
215
 
 * Set/get the value for UseWTS. Also a static, but it's going away.
216
 
 */
217
 
void gs_setusewts(bool);
218
 
bool gs_currentusewts(void);
219
 
 
220
 
/* Initiate screen sampling with optional AccurateScreens. */
221
 
int gs_screen_init_memory(gs_screen_enum *, gs_state *,
222
 
                          gs_screen_halftone *, bool, gs_memory_t *);
223
 
 
224
 
#define gs_screen_init_accurate(penum, pgs, phsp, accurate)\
225
 
  gs_screen_init_memory(penum, pgs, phsp, accurate, pgs->memory)
226
 
 
227
 
/* Procedural interface for MinScreenLevels (a Ghostscript extension) */
228
 
 
229
 
/*
230
 
 * Set/get the MinScreenLevels value.
231
 
 *
232
 
 * Note that this value is stored in a static variable.
233
 
 */
234
 
void gs_setminscreenlevels(uint);
235
 
uint gs_currentminscreenlevels(void);
236
 
 
237
 
#endif /* gxht_INCLUDED */