xref: /plan9/sys/src/cmd/gs/src/gdevcmap.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1998, 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: gdevcmap.h,v 1.5 2002/06/16 07:25:26 lpd Exp $ */
18 /* Interface to special color mapping device */
19 
20 #ifndef gdevcmap_INCLUDED
21 #  define gdevcmap_INCLUDED
22 
23 /* Define the color mapping algorithms. */
24 typedef enum {
25 
26     /* Don't change the color. */
27 
28     device_cmap_identity = 0,
29 
30     /* Snap each RGB primary component to 0 or 1 individually. */
31 
32     device_cmap_snap_to_primaries,
33 
34     /* Snap black to white, other colors to black. */
35 
36     device_cmap_color_to_black_over_white,
37 
38     /* Convert to a gray shade of the correct brightness. */
39 
40     device_cmap_monochrome
41 
42 } gx_device_color_mapping_method_t;
43 
44 #define device_cmap_max_method device_cmap_monochrome
45 
46 /* Define the color mapping forwarding device. */
47 typedef struct gx_device_cmap_s {
48     gx_device_forward_common;
49     gx_device_color_mapping_method_t mapping_method;
50 } gx_device_cmap;
51 
52 extern_st(st_device_cmap);
53 #define public_st_device_cmap()	/* in gdevcmap.c */\
54   gs_public_st_suffix_add0_final(st_device_cmap, gx_device_cmap,\
55     "gx_device_cmap", device_cmap_enum_ptrs, device_cmap_reloc_ptrs,\
56     gx_device_finalize, st_device_forward)
57 
58 /* Initialize a color mapping device.  Do this just once after allocation. */
59 int gdev_cmap_init(gx_device_cmap * dev, gx_device * target,
60 		   gx_device_color_mapping_method_t mapping_method);
61 
62 /*
63  * Clients can change the color mapping method at any time by setting
64  * the ColorMappingMethod device parameter, but they must then call
65  *	gs_setdevice_no_init(pgs, dev);
66  * for each graphics state that may reference the device.
67  */
68 
69 #endif /* gdevcmap_INCLUDED */
70