xref: /plan9/sys/src/cmd/gs/src/gscdevn.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2000 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: gscdevn.h,v 1.8 2003/09/09 12:44:12 igor Exp $ */
18 /* Client interface to DeviceN color */
19 
20 #ifndef gscdevn_INCLUDED
21 #  define gscdevn_INCLUDED
22 
23 #include "gscspace.h"
24 
25 /*
26  * Fill in a DeviceN color space.  Does not include allocation
27  * and initialization of the color space.
28  * Note that the client is responsible for memory management of the
29  * tint transform Function.
30  */
31 int gs_build_DeviceN(
32 			gs_color_space *pcspace,
33 			uint num_components,
34 			const gs_color_space *palt_cspace,
35 			gs_memory_t *pmem
36 			);
37 /*
38  * Allocate and fill in a DeviceN color space.
39  * Note that the client is responsible for memory management of the
40  * tint transform Function.
41  */
42 int gs_cspace_build_DeviceN(
43 			       gs_color_space **ppcspace,
44 			       gs_separation_name *psnames,
45 			       uint num_components,
46 			       const gs_color_space *palt_cspace,
47 			       gs_memory_t *pmem
48 			       );
49 
50 /* Set the tint transformation procedure for a DeviceN color space. */
51 /* VMS limits procedure names to 31 characters, and some systems only */
52 /* compare the first 23 characters. */
53 extern int gs_cspace_set_devn_proc(
54 				      gs_color_space * pcspace,
55 			int (*proc)(const float *,
56 				       float *,
57 				       const gs_imager_state *,
58 				       void *
59 				      ),
60 				      void *proc_data
61 				      );
62 
63 /* Set the DeviceN tint transformation procedure to a Function. */
64 #ifndef gs_function_DEFINED
65 typedef struct gs_function_s gs_function_t;
66 #  define gs_function_DEFINED
67 #endif
68 int gs_cspace_set_devn_function(gs_color_space *pcspace,
69 				   gs_function_t *pfn);
70 
71 /*
72  * If the DeviceN tint transformation procedure is a Function,
73  * return the function object, otherwise return 0.
74  */
75 gs_function_t *gs_cspace_get_devn_function(const gs_color_space *pcspace);
76 
77 /* Map a DeviceN color using a Function. */
78 int map_devn_using_function(const float *in, float *out,
79 			const gs_imager_state *pis, void *data);
80 
81 /* Serialize a DeviceN map. */
82 int gx_serialize_device_n_map(const gs_color_space * pcs, gs_device_n_map * m, stream * s);
83 
84 
85 #endif /* gscdevn_INCLUDED */
86