1 /* Copyright (C) 2001-2006 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, modified
8    or distributed except as expressly authorized under the terms of that
9    license.  Refer to licensing information at http://www.artifex.com/
10    or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11    San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12 */
13 
14 /* $Id: gxcvalue.h 8022 2007-06-05 22:23:38Z giles $ */
15 /* Definition of device color values */
16 
17 #ifndef gxcvalue_INCLUDED
18 #  define gxcvalue_INCLUDED
19 
20 /* Define the type for gray or RGB values at the driver interface. */
21 typedef unsigned short gx_color_value;
22 
23 #define arch_sizeof_gx_color_value arch_sizeof_short
24 /* We might use less than the full range someday. */
25 /* ...bits must lie between 8 and 16. */
26 #define gx_color_value_bits (sizeof(gx_color_value) * 8)
27 #define gx_max_color_value ((gx_color_value)((1L << gx_color_value_bits) - 1))
28 #define gx_color_value_to_byte(cv)\
29   ((cv) >> (gx_color_value_bits - 8))
30 #define gx_color_value_from_byte(cb)\
31   (((cb) << (gx_color_value_bits - 8)) + ((cb) >> (16 - gx_color_value_bits)))
32 
33 /* Convert between gx_color_values and fracs. */
34 #define frac2cv(fr) frac2ushort(fr)
35 #define cv2frac(cv) ushort2frac(cv)
36 
37 #endif /* gxcvalue_INCLUDED */
38