xref: /plan9/sys/src/cmd/gs/src/icie.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1995, 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: icie.h,v 1.7 2004/08/04 19:36:12 stefan Exp $ */
18 /* Internal definitions for interpreter CIE color handling */
19 
20 #ifndef icie_INCLUDED
21 #  define icie_INCLUDED
22 
23 /*
24  * All of the routines below are exported by zcie.c for zcrd.c,
25  * except for cie_cache_joint which is exported by zcrd.c for zcie.c.
26  */
27 
28 /* ------ Parameter acquisition ------ */
29 
30 /* Get a range array parameter from a dictionary. */
31 /* We know that count <= 4. */
32 int dict_ranges_param(const gs_memory_t *mem,
33 		      const ref * pdref, const char *kstr, int count,
34 		      gs_range * prange);
35 
36 /* Get 3 ranges from a dictionary. */
37 int dict_range3_param(const gs_memory_t *mem,
38 		      const ref *pdref, const char *kstr,
39 		      gs_range3 *prange3);
40 
41 /* Get a 3x3 matrix parameter from a dictionary. */
42 int dict_matrix3_param(const gs_memory_t *mem, const ref *pdref,
43 		       const char *kstr,
44 		       gs_matrix3 *pmat3);
45 
46 /* Get an array of procedures from a dictionary. */
47 /* We know count <= countof(empty_procs). */
48 int dict_proc_array_param(const gs_memory_t *mem, const ref *pdict,
49 			  const char *kstr,
50 			  uint count, ref * pparray);
51 
52 /* Get 3 procedures from a dictionary. */
53 int dict_proc3_param(const gs_memory_t *mem, const ref *pdref,
54 		     const char *kstr, ref proc3[3]);
55 
56 /* Get WhitePoint and BlackPoint values. */
57 int cie_points_param(const gs_memory_t *mem,
58 		     const ref * pdref, gs_cie_wb * pwb);
59 
60 /* Process a 3- or 4-dimensional lookup table from a dictionary. */
61 /* The caller has set pclt->n and pclt->m. */
62 /* ptref is known to be a readable array of size at least n+1. */
63 int cie_table_param(const ref * ptable, gx_color_lookup_table * pclt,
64 		    gs_memory_t * mem);
65 
66 /* ------ Internal routines ------ */
67 
68 int cie_set_finish(i_ctx_t *, gs_color_space *,
69 		   const ref_cie_procs *, int, int);
70 
71 int cie_cache_push_finish(i_ctx_t *i_ctx_p, op_proc_t finish_proc,
72 			  gs_ref_memory_t * imem, void *data);
73 int cie_prepare_cache(i_ctx_t *i_ctx_p, const gs_range * domain,
74 		      const ref * proc, cie_cache_floats * pcache,
75 		      void *container, gs_ref_memory_t * imem,
76 		      client_name_t cname);
77 int cie_prepare_caches_4(i_ctx_t *i_ctx_p, const gs_range * domains,
78 			 const ref * procs,
79 			 cie_cache_floats * pc0,
80 			 cie_cache_floats * pc1,
81 			 cie_cache_floats * pc2,
82 			 cie_cache_floats * pc3 /* may be 0 */,
83 			 void *container,
84 			 gs_ref_memory_t * imem, client_name_t cname);
85 #define cie_prepare_cache3(p,d3,p3,c3,pcie,imem,cname)\
86   cie_prepare_caches_4(p, (d3)->ranges, p3,\
87 		       &(c3)->floats, &(c3)[1].floats, &(c3)[2].floats,\
88 		       NULL, pcie, imem, cname)
89 #define cie_prepare_cache4(p,d4,p4,c4,pcie,imem,cname)\
90   cie_prepare_caches_4(p, (d4)->ranges, p4,\
91 		       &(c4)->floats, &(c4)[1].floats, &(c4)[2].floats,\
92 		       &(c4)[3].floats, pcie, imem, cname)
93 
94 int cie_cache_joint(i_ctx_t *, const ref_cie_render_procs *,
95 		    const gs_cie_common *, gs_state *);
96 
97 #endif /* icie_INCLUDED */
98