xref: /plan9/sys/src/cmd/gs/src/gdevmrun.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1999 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: gdevmrun.h,v 1.5 2002/06/16 07:25:26 lpd Exp $ */
18 /* Definition of run-length encoded memory device */
19 
20 #ifndef gdevmrun_INCLUDED
21 #  define gdevmrun_INCLUDED
22 
23 /*
24  * This memory device stores full-size pixels with run-length
25  * encoding if possible, switching to the standard uncompressed
26  * representation if necessary.
27  */
28 
29 #include "gxdevmem.h"
30 
31 /*
32  * Define the device, built on a memory device.
33  */
34 typedef struct gx_device_run_s {
35     gx_device_memory md;	/* must be first */
36     uint runs_per_line;
37     int umin, umax1;		/* some range of uninitialized lines */
38     int smin, smax1;		/* some range in standard (not run) form */
39     /*
40      * Save memory device procedures that we replace with run-oriented
41      * ones, for use with the uncompressed representation.
42      */
43     struct sp_ {
44 	dev_proc_copy_mono((*copy_mono));
45 	dev_proc_copy_color((*copy_color));
46 	dev_proc_fill_rectangle((*fill_rectangle));
47 	dev_proc_copy_alpha((*copy_alpha));
48 	dev_proc_strip_tile_rectangle((*strip_tile_rectangle));
49 	dev_proc_strip_copy_rop((*strip_copy_rop));
50 	dev_proc_get_bits_rectangle((*get_bits_rectangle));
51     } save_procs;
52 } gx_device_run;
53 
54 /*
55  * Convert a memory device to run-length form.  The mdev argument should be
56  * const, but it isn't because we need to call gx_device_white.
57  */
58 int gdev_run_from_mem(gx_device_run *rdev, gx_device_memory *mdev);
59 
60 #endif /* gdevmrun_INCLUDED */
61