1 /* Copyright (C) 1997, 1998 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: gxband.h,v 1.2.6.1.2.1 2003/01/17 00:49:03 giles Exp $ */
20 /* Band-processing parameters for Ghostscript */
21 
22 #ifndef gxband_INCLUDED
23 #  define gxband_INCLUDED
24 
25 #include "gxclio.h"
26 
27 /*
28  * Define the parameters controlling banding.
29  */
30 typedef struct gx_band_params_s {
31     int BandWidth;		/* (optional) band width in pixels */
32     int BandHeight;		/* (optional) */
33     long BandBufferSpace;	/* (optional) */
34 } gx_band_params_t;
35 
36 #define BAND_PARAMS_INITIAL_VALUES 0, 0, 0
37 
38 /*
39  * Define information about the colors used on a page.
40  */
41 typedef struct gx_colors_used_s {
42     gx_color_index or;		/* the "or" of all the used colors */
43     bool slow_rop;		/* true if any RasterOps that can't be */
44 				/* executed plane-by-plane on CMYK devices */
45 } gx_colors_used_t;
46 
47 /*
48  * We want to store color usage information for each band in the page_info
49  * structure, but we also want this structure to be of a fixed (and
50  * reasonable) size.  We do this by allocating a fixed number of colors_used
51  * structures in the page_info structure, and if there are more bands than
52  * we have allocated, we simply reduce the precision of the information by
53  * letting each colors_used structure cover multiple bands.
54  *
55  * 30 entries would be large enough to cover A4 paper (11.3") at 600 dpi
56  * with 256-scan-line bands.  We pick 50 somewhat arbitrarily.
57  */
58 #define PAGE_INFO_NUM_COLORS_USED 50
59 
60 /*
61  * Define the information for a saved page.
62  */
63 typedef struct gx_band_page_info_s {
64     char cfname[gp_file_name_sizeof];	/* command file name */
65     clist_file_ptr cfile;	/* command file, normally 0 */
66     char bfname[gp_file_name_sizeof];	/* block file name */
67     clist_file_ptr bfile;	/* block file, normally 0 */
68     uint tile_cache_size;	/* size of tile cache */
69     long bfile_end_pos;		/* ftell at end of bfile */
70     gx_band_params_t band_params;  /* parameters used when writing band list */
71 				/* (actual values, no 0s) */
72     int scan_lines_per_colors_used; /* number of scan lines per colors_used */
73 				/* entry (a multiple of the band height) */
74     gx_colors_used_t band_colors_used[PAGE_INFO_NUM_COLORS_USED];  /* colors used on the page */
75 } gx_band_page_info_t;
76 #define PAGE_INFO_NULL_VALUES\
77   { 0 }, 0, { 0 }, 0, 0, 0, { BAND_PARAMS_INITIAL_VALUES },\
78   0x3fffffff, { { 0 } }
79 
80 /*
81  * By convention, the structure member containing the above is called
82  * page_info.  Define shorthand accessors for its members.
83  */
84 #define page_cfile page_info.cfile
85 #define page_cfname page_info.cfname
86 #define page_bfile page_info.bfile
87 #define page_bfname page_info.bfname
88 #define page_tile_cache_size page_info.tile_cache_size
89 #define page_bfile_end_pos page_info.bfile_end_pos
90 #define page_band_height page_info.band_params.BandHeight
91 
92 #endif /* ndef gxband_INCLUDED */
93