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: gxbitfmt.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* Definitions for bitmap storage formats */
17
#ifndef gxbitfmt_INCLUDED
18
# define gxbitfmt_INCLUDED
21
* Several operations, such as the get_bits_rectangle driver procedure, can
22
* take and/or produce data in a flexible variety of formats; the ability to
23
* describe how bitmap data is stored is useful in other contexts as well.
24
* We define bitmap storage formats using a bit mask: this allows a
25
* procedure to ask for, or offer to provide, data in more than one format.
28
typedef ulong gx_bitmap_format_t;
31
* Define the supported color space alternatives.
34
#define GB_COLORS_NATIVE (1L<<0) /* native representation (DevicePixel) */
35
#define GB_COLORS_GRAY (1L<<1) /* DeviceGray */
36
#define GB_COLORS_RGB (1L<<2) /* DeviceRGB */
37
#define GB_COLORS_CMYK (1L<<3) /* DeviceCMYK */
39
#define GB_COLORS_STANDARD_ALL\
40
(GB_COLORS_GRAY | GB_COLORS_RGB | GB_COLORS_CMYK)
41
#define GB_COLORS_ALL\
42
(GB_COLORS_NATIVE | GB_COLORS_STANDARD_ALL)
43
#define GB_COLORS_NAMES\
44
"colors_native", "colors_Gray", "colors_RGB", "colors_CMYK"
47
* Define whether alpha information is included. For GB_COLORS_NATIVE,
48
* all values other than GB_ALPHA_NONE are equivalent.
51
#define GB_ALPHA_NONE (1L<<4) /* no alpha */
52
#define GB_ALPHA_FIRST (1L<<5) /* include alpha as first component */
53
#define GB_ALPHA_LAST (1L<<6) /* include alpha as last component */
54
/*unused*/ /*(1L<<7)*/
57
(GB_ALPHA_NONE | GB_ALPHA_FIRST | GB_ALPHA_LAST)
58
#define GB_ALPHA_NAMES\
59
"alpha_none", "alpha_first", "alpha_last", "?alpha_unused?"
62
* Define the supported depths per component for GB_COLORS_STANDARD.
63
* For GB_COLORS_NATIVE with planar packing, it is the client's
64
* responsibility to know how the device divides up the bits of the
68
#define GB_DEPTH_1 (1L<<8)
69
#define GB_DEPTH_2 (1L<<9)
70
#define GB_DEPTH_4 (1L<<10)
71
#define GB_DEPTH_8 (1L<<11)
72
#define GB_DEPTH_12 (1L<<12)
73
#define GB_DEPTH_16 (1L<<13)
74
/*unused1*/ /*(1L<<14)*/
75
/*unused2*/ /*(1L<<15)*/
78
(GB_DEPTH_1 | GB_DEPTH_2 | GB_DEPTH_4 | GB_DEPTH_8 |\
79
GB_DEPTH_12 | GB_DEPTH_16)
80
#define GB_DEPTH_NAMES\
81
"depth_1", "depth_2", "depth_4", "depth_8",\
82
"depth_12", "depth_16", "?depth_unused1?", "?depth_unused2?"
84
/* Find the maximum depth of an options mask. */
85
#define GB_OPTIONS_MAX_DEPTH(opt)\
87
\000\001\002\002\004\004\004\004\010\010\010\010\010\010\010\010\
88
\014\014\014\014\014\014\014\014\014\014\014\014\014\014\014\014\
89
\020\020\020\020\020\020\020\020\020\020\020\020\020\020\020\020\
90
\020\020\020\020\020\020\020\020\020\020\020\020\020\020\020\020\
91
"[((opt) >> 8) & 0x3f]
92
/* Find the depth of an options mask with exactly 1 bit set. */
93
#define GB_OPTIONS_DEPTH(opt)\
94
((((opt) >> 8) & 0xf) |\
95
"\000\000\014\020"[((opt) >> 12) & 3])
98
* Define the supported packing formats. Currently, GB_PACKING_PLANAR is
99
* only partially supported, and GB_PACKING_BIT_PLANAR is hardly supported
103
#define GB_PACKING_CHUNKY (1L<<16)
104
#define GB_PACKING_PLANAR (1L<<17) /* 1 plane per component */
105
#define GB_PACKING_BIT_PLANAR (1L<<18) /* 1 plane per bit */
107
#define GB_PACKING_ALL\
108
(GB_PACKING_CHUNKY | GB_PACKING_PLANAR | GB_PACKING_BIT_PLANAR)
109
#define GB_PACKING_NAMES\
110
"packing_chunky", "packing_planar", "packing_bit_planar"
113
* Define whether to return a subset of the planes. With planar packing
114
* formats, if this is set, only those planes that had non-zero data
115
* pointers originally will be returned (either by copying or by
116
* pointer). With chunky packing, if this is set, only an undefined
117
* subset of the returned bits may be valid.
120
#define GB_SELECT_PLANES (1L<<19)
121
#define GB_SELECT_ALL\
123
#define GB_SELECT_NAMES\
127
* Define the possible methods of returning data.
130
#define GB_RETURN_COPY (1L<<20) /* copy to client's buffer */
131
#define GB_RETURN_POINTER (1L<<21) /* return pointers to data */
133
#define GB_RETURN_ALL\
134
(GB_RETURN_COPY | GB_RETURN_POINTER)
135
#define GB_RETURN_NAMES\
136
"return_copy", "return_pointer"
139
* Define the allowable alignments. This is only relevant for
140
* GB_RETURN_POINTER: for GB_RETURN_COPY, any alignment is
144
#define GB_ALIGN_STANDARD (1L<<22) /* require standard bitmap alignment */
145
#define GB_ALIGN_ANY (1L<<23) /* any alignment is acceptable */
147
#define GB_ALIGN_ALL\
148
(GB_ALIGN_ANY | GB_ALIGN_STANDARD)
149
#define GB_ALIGN_NAMES\
150
"align_standard", "align_any"
153
* Define the allowable X offsets. GB_OFFSET_ANY is only relevant for
154
* GB_RETURN_POINTER: for GB_RETURN_COPY, clients must specify
155
* the offset so they know how much space to allocate.
158
#define GB_OFFSET_0 (1L<<24) /* no offsetting */
159
#define GB_OFFSET_SPECIFIED (1L<<25) /* client-specified offset */
160
#define GB_OFFSET_ANY (1L<<26) /* any offset is acceptable */
161
/* (for GB_RETURN_POINTER only) */
162
/*unused*/ /*(1L<<27)*/
164
#define GB_OFFSET_ALL\
165
(GB_OFFSET_0 | GB_OFFSET_SPECIFIED | GB_OFFSET_ANY)
166
#define GB_OFFSET_NAMES\
167
"offset_0", "offset_specified", "offset_any", "?offset_unused?"
170
* Define the allowable rasters. GB_RASTER_ANY is only relevant for
171
* GB_RETURN_POINTER, for the same reason as GB_OFFSET_ANY.
172
* Note also that if GB_ALIGN_STANDARD and GB_RASTER_SPECIFIED are
173
* both chosen and more than one scan line is being transferred,
174
* the raster value must also be aligned (i.e., 0 mod align_bitmap_mod).
175
* Implementors are not required to check this.
179
* Standard raster is bitmap_raster(dev->width) for return_ptr,
180
* bitmap_raster(x_offset + width) for return_copy,
181
* padding per alignment.
183
#define GB_RASTER_STANDARD (1L<<28)
184
#define GB_RASTER_SPECIFIED (1L<<29) /* any client-specified raster */
185
#define GB_RASTER_ANY (1L<<30) /* any raster is acceptable (for */
186
/* GB_RETURN_POINTER only) */
188
#define GB_RASTER_ALL\
189
(GB_RASTER_STANDARD | GB_RASTER_SPECIFIED | GB_RASTER_ANY)
190
#define GB_RASTER_NAMES\
191
"raster_standard", "raster_specified", "raster_any"
194
* Return halftoned raster. (This requires a custom get_bit_rectangle
195
* device procedure. See the wtsimdi device. Most devices ignore this
198
#define GB_HALFTONED (1L<<31)
199
#define GB_HALFTONED_NAMES\
200
"halftoned_no", "halftoned_yes"
202
/* Define names for debugging printout. */
203
#define GX_BITMAP_FORMAT_NAMES\
204
GB_COLORS_NAMES, GB_ALPHA_NAMES, GB_DEPTH_NAMES, GB_PACKING_NAMES,\
205
GB_SELECT_NAMES, GB_RETURN_NAMES, GB_ALIGN_NAMES, GB_OFFSET_NAMES,\
206
GB_RASTER_NAMES, GB_HALFTONE_NAMES
208
#endif /* gxbitfmt_INCLUDED */