1 /* Copyright (C) 2001-2019 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,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Band-processing parameters for Ghostscript */
18 
19 #ifndef gxband_INCLUDED
20 #  define gxband_INCLUDED
21 
22 #include "gxclio.h"
23 #include "gxdevcli.h"
24 
25 /* We hold color usage as a bitfield that needs to be at least as wide as
26  * a gx_color_index - so for simplicity define it that way, even though
27  * the two are not equal. */
28 typedef gx_color_index gx_color_usage_bits;
29 
30 #define gx_color_usage_all(dev) \
31   (((gx_color_usage_bits)1 << (dev)->color_info.num_components) - 1)
32 
33 gx_color_usage_bits gx_color_index2usage(gx_device *dev, gx_color_index);
34 
35 /*
36  * Define information about the colors used on a page.
37  */
38 typedef struct gx_colors_usage_s {
39     gx_color_usage_bits or;	/* the "or" of all the used colors */
40     bool slow_rop;		/* true if any RasterOps that can't be */
41                                 /* executed plane-by-plane on CMYK devices */
42     gs_int_rect trans_bbox;	/* transparency bbox allows skipping the pdf14 compositor for some bands */
43                                 /* coordinates are band relative, 0 <= p.y < page_band_height */
44 } gx_color_usage_t;
45 
46 /*
47  * Define the information for a saved page.
48  */
49 typedef struct gx_band_page_info_s {
50     char cfname[gp_file_name_sizeof];	/* command file name */
51     clist_file_ptr cfile;	/* command file, normally 0 */
52     char bfname[gp_file_name_sizeof];	/* block file name */
53     clist_file_ptr bfile;	/* block file, normally 0 */
54     const clist_io_procs_t *io_procs;
55     uint tile_cache_size;	/* size of tile cache */
56     ulong line_ptrs_offset;      /* Offset of line_ptrs within tile cache */
57     int64_t bfile_end_pos;		/* ftell at end of bfile */
58     gx_band_params_t band_params;  /* parameters used when writing band list */
59                                 /* (actual values, no 0s) */
60 } gx_band_page_info_t;
61 #define PAGE_INFO_NULL_VALUES\
62   { 0 }, 0, { 0 }, NULL, 0, 0, 0, 0, { BAND_PARAMS_INITIAL_VALUES }
63 
64 /*
65  * By convention, the structure member containing the above is called
66  * page_info.  Define shorthand accessors for its members.
67  */
68 #define page_cfile page_info.cfile
69 #define page_cfname page_info.cfname
70 #define page_bfile page_info.bfile
71 #define page_bfname page_info.bfname
72 #define page_tile_cache_size page_info.tile_cache_size
73 #define page_line_ptrs_offset page_info.line_ptrs_offset
74 #define page_bfile_end_pos page_info.bfile_end_pos
75 #define page_band_height page_info.band_params.BandHeight
76 
77 #endif /* ndef gxband_INCLUDED */
78