1 /* Copyright (C) 2001-2012 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.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 /* Definition of run-length encoded memory device */
17 
18 #ifndef gdevmrun_INCLUDED
19 #  define gdevmrun_INCLUDED
20 
21 /*
22  * This memory device stores full-size pixels with run-length
23  * encoding if possible, switching to the standard uncompressed
24  * representation if necessary.
25  */
26 
27 #include "gxdevmem.h"
28 
29 /*
30  * Define the device, built on a memory device.
31  */
32 typedef struct gx_device_run_s {
33     gx_device_memory md;	/* must be first */
34     uint runs_per_line;
35     int umin, umax1;		/* some range of uninitialized lines */
36     int smin, smax1;		/* some range in standard (not run) form */
37     /*
38      * Save memory device procedures that we replace with run-oriented
39      * ones, for use with the uncompressed representation.
40      */
41     struct sp_ {
42         dev_proc_copy_mono((*copy_mono));
43         dev_proc_copy_color((*copy_color));
44         dev_proc_fill_rectangle((*fill_rectangle));
45         dev_proc_copy_alpha((*copy_alpha));
46         dev_proc_strip_tile_rectangle((*strip_tile_rectangle));
47         dev_proc_strip_copy_rop((*strip_copy_rop));
48         dev_proc_get_bits_rectangle((*get_bits_rectangle));
49     } save_procs;
50 } gx_device_run;
51 
52 /*
53  * Convert a memory device to run-length form.  The mdev argument should be
54  * const, but it isn't because we need to call gx_device_white.
55  */
56 int gdev_run_from_mem(gx_device_run *rdev, gx_device_memory *mdev);
57 
58 #endif /* gdevmrun_INCLUDED */
59