1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
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.
14
/* $Id: gshtx.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* High-level interface to stand-alone halftone/transfer objects */
17
#ifndef gshtx_INCLUDED
18
# define gshtx_INCLUDED
26
* The stand-alone halftone structures are opaque, and are placed in an opaque
30
/* Alias type names */
31
#define gs_ht gs_halftone
32
#define gs_spot_ht gs_spot_halftone
33
#define gs_threshold_ht gs_threshold_halftone
34
#define gs_ht_component gs_halftone_component
35
#define gs_multiple_ht gs_multiple_halftone
36
/* Alias GC descriptors */
37
#define st_gs_ht st_halftone
38
#define st_ht_comp_element st_ht_component_element
39
/* Alias member names */
41
#define ht_threshold threshold
42
#define ht_multiple multiple
44
#ifndef gs_state_DEFINED
45
# define gs_state_DEFINED
46
typedef struct gs_state_s gs_state;
51
* A "closure" form of gs_mapping_proc. This allows the procedure to access
52
* client data for the purpose of filling in the transfer information.
54
* As with PostScript transfer functions, the operand will be in the range
55
* [0, 1], and the result should be in the same range.
57
typedef gs_mapping_closure_proc_t gs_ht_transfer_proc; /* see gxtmap.h */
60
* Constructor, destructor, assign, and copy routines for a gs_ht
61
* structure, and to install them in the graphic state.
65
* Construction of a gs_ht halftone requires two steps: creating the
66
* overall halftone, and creating each of the components. Client data
67
* must be provided for each of the latter steps.
69
* The type field of gs_ht halftones will always be ht_type_multiple;
70
* if only one component is required, this halftone will always be given
71
* the component name "Default".
73
* The type fields of the gs_ht_component structures pointed to by the
74
* gs_multiple_ht structure will have the value ht_type_spot or
75
* ht_type_threshold; the constructor routines will not build any
78
* Individual component halftones of a gs_ht structure must always be
79
* provided with transfer functions.
81
* Releasing the gs_ht structure will NOT release the client data
82
* (the client must do that directly).
85
extern int gs_ht_build(gs_ht ** ppht, uint num_comps, gs_memory_t * pmem);
87
extern int gs_ht_set_spot_comp(
92
float (*spot_func) (floatp, floatp),
94
gs_ht_transfer_proc transfer,
95
const void *client_data
98
extern int gs_ht_set_threshold_comp(
103
const gs_const_string * thresholds,
104
gs_ht_transfer_proc transfer,
105
const void *client_data
109
* This procedure specifies a (possibly non-monotonic) halftone of size
110
* width x height with num_levels different levels (including white, always
111
* all 0s, but excluding black, always all 1s). Each mask is in the form of
112
* a gs_bitmap, except that there is no row padding -- the 'raster' is
115
* Note that the client is responsible for releasing the mask data.
117
extern int gs_ht_set_mask_comp(
123
const byte * masks, /* width x height x num_levels */
124
gs_ht_transfer_proc transfer,
125
const void *client_data
128
extern void gs_ht_reference(gs_ht * pht);
129
extern void gs_ht_release(gs_ht * pht);
131
#define gs_ht_assign(pto, pfrom) \
133
gs_ht_reference(pfrom); \
135
gs_ht_release(pto); \
139
#define gs_ht_init_ptr(pto, pfrom) \
140
BEGIN gs_ht_reference(pfrom); pto = pfrom; END
142
extern int gs_ht_install(gs_state * pgs, gs_ht * pht);
144
#endif /* gshtx_INCLUDED */