xref: /plan9/sys/src/cmd/gs/src/gdevplnx.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gdevplnx.h,v 1.5 2002/06/16 07:25:26 lpd Exp $*/
18 /* Definitions and API for plane extraction device */
19 /* Requires gxdevcli.h */
20 
21 #ifndef gdevplnx_INCLUDED
22 #  define gdevplnx_INCLUDED
23 
24 #include "gxrplane.h"
25 
26 /*
27  * A plane-extraction device appears to its client to be a color-capable
28  * device, like its target; but it actually extracts a single color plane
29  * for rendering to yet another device, called the plane device (normally,
30  * but not necessarily, a memory device).  Clients must know the pixel
31  * representation in detail, since the plane is specified as a particular
32  * group of bits within the pixel.
33  *
34  * The original purpose of plane-extraction devices is for band list
35  * rendering for plane-oriented color printers.  Each per-plane rasterizing
36  * pass over the band list sends the output to a plane-extraction device for
37  * the plane being printed.  There is one special optimization to support
38  * this: on the theory that even bands containing output for multiple bands
39  * are likely to have many objects that only write white into that band, we
40  * remember whether any (non-white) marks have been made on the page so far,
41  * and if not, we simply skip any rendering operations that write white.
42  *
43  * The depth of the plane_extract device and its target are limited to 32
44  * bits; the depth of each plane is limited to 8 bits.  We could raise these
45  * without too much trouble if necessary, as long as each plane didn't
46  * exceed 32 bits.
47  */
48 
49 typedef struct gx_device_plane_extract_s {
50     gx_device_forward_common;
51 	/* The following are set by the client before opening the device. */
52     gx_device *plane_dev;		/* the drawing device for the plane */
53     gx_render_plane_t plane;
54 	/* The following are set by open_device. */
55     gx_color_index plane_white;
56     uint plane_mask;
57     bool plane_dev_is_memory;
58 	/* The following change dynamically. */
59     bool any_marks;
60 } gx_device_plane_extract;
61 extern_st(st_device_plane_extract);
62 #define public_st_device_plane_extract()	/* in gdevplnx.c */\
63   gs_public_st_complex_only(st_device_plane_extract, gx_device_plane_extract,\
64     "gx_device_plane_extract", 0, device_plane_extract_enum_ptrs,\
65     device_plane_extract_reloc_ptrs, gx_device_finalize)
66 
67 /* Initialize a plane extraction device. */
68 int plane_device_init(gx_device_plane_extract *edev, gx_device *target,
69 		      gx_device *plane_dev,
70 		      const gx_render_plane_t *render_plane, bool clear);
71 
72 #endif /* gdevplnx_INCLUDED */
73