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