xref: /plan9-contrib/sys/src/cmd/gs/src/gdevmrun.h (revision d46c239f8612929b7dbade67d0d071633df3a15d)
1 /* Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
2 
3   This file is part of AFPL Ghostscript.
4 
5   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
6   distributor accepts any responsibility for the consequences of using it, or
7   for whether it serves any particular purpose or works at all, unless he or
8   she says so in writing.  Refer to the Aladdin Free Public License (the
9   "License") for full details.
10 
11   Every copy of AFPL Ghostscript must include a copy of the License, normally
12   in a plain ASCII text file named PUBLIC.  The License grants you the right
13   to copy, modify and redistribute AFPL Ghostscript, but only under certain
14   conditions described in the License.  Among other things, the License
15   requires that the copyright notice and this notice be preserved on all
16   copies.
17 */
18 
19 /*$Id: gdevmrun.h,v 1.2 2000/09/19 19:00:14 lpd Exp $ */
20 /* Definition of run-length encoded memory device */
21 
22 #ifndef gdevmrun_INCLUDED
23 #  define gdevmrun_INCLUDED
24 
25 /*
26  * This memory device stores full-size pixels with run-length
27  * encoding if possible, switching to the standard uncompressed
28  * representation if necessary.
29  */
30 
31 #include "gxdevmem.h"
32 
33 /*
34  * Define the device, built on a memory device.
35  */
36 typedef struct gx_device_run_s {
37     gx_device_memory md;	/* must be first */
38     uint runs_per_line;
39     int umin, umax1;		/* some range of uninitialized lines */
40     int smin, smax1;		/* some range in standard (not run) form */
41     /*
42      * Save memory device procedures that we replace with run-oriented
43      * ones, for use with the uncompressed representation.
44      */
45     struct sp_ {
46 	dev_proc_copy_mono((*copy_mono));
47 	dev_proc_copy_color((*copy_color));
48 	dev_proc_fill_rectangle((*fill_rectangle));
49 	dev_proc_copy_alpha((*copy_alpha));
50 	dev_proc_strip_tile_rectangle((*strip_tile_rectangle));
51 	dev_proc_strip_copy_rop((*strip_copy_rop));
52 	dev_proc_get_bits_rectangle((*get_bits_rectangle));
53     } save_procs;
54 } gx_device_run;
55 
56 /*
57  * Convert a memory device to run-length form.  The mdev argument should be
58  * const, but it isn't because we need to call gx_device_white.
59  */
60 int gdev_run_from_mem(P2(gx_device_run *rdev, gx_device_memory *mdev));
61 
62 #endif /* gdevmrun_INCLUDED */
63