xref: /plan9/sys/src/cmd/gs/src/gscrd.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: gscrd.h,v 1.7 2004/08/04 19:36:12 stefan Exp $ */
18 /* Interface for CIE color rendering dictionary creation */
19 
20 #ifndef gscrd_INCLUDED
21 #  define gscrd_INCLUDED
22 
23 #include "gscie.h"
24 
25 /*
26  * Allocate and minimally initialize a CRD.  Note that this procedure sets
27  * the reference count of the structure to 1, not 0.  gs_setcolorrendering
28  * will increment the reference count again, so unless you want the
29  * structure to stay allocated permanently (or until a garbage collection),
30  * you should call rc_decrement(pcrd, "client name") *after* calling
31  * gs_setcolorrendering.
32  */
33 int
34     gs_cie_render1_build(gs_cie_render ** ppcrd, gs_memory_t * mem,
35 			 client_name_t cname);
36 
37 /*
38  * Initialize a CRD given all of the relevant parameters.
39  * Any of the pointers except WhitePoint may be zero, meaning
40  * use the default values.
41  *
42  * The actual point, matrix, range, and procedure values are copied into the
43  * CRD, but only the pointer to the color lookup table
44  * (RenderTable.lookup.table) is copied, not the table itself.
45  *
46  * If pfrom_crd is not NULL, then if the EncodeLMN, EncodeABC, or
47  * RenderTable.T procedures indicate that the values exist only in the
48  * cache, the corresponding values will be copied from pfrom_crd.
49  * Note that NULL values for the individual pointers still represent
50  * default values.
51  */
52 int
53     gs_cie_render1_init_from(const gs_memory_t  *mem,
54 	    		     gs_cie_render *pcrd,
55 			     void *client_data,
56 			     const gs_cie_render * pfrom_crd,
57 			     const gs_vector3 * WhitePoint,
58 			     const gs_vector3 * BlackPoint,
59 			     const gs_matrix3 * MatrixPQR,
60 			     const gs_range3 * RangePQR,
61 			     const gs_cie_transform_proc3 * TransformPQR,
62 			     const gs_matrix3 * MatrixLMN,
63 			     const gs_cie_render_proc3 * EncodeLMN,
64 			     const gs_range3 * RangeLMN,
65 			     const gs_matrix3 * MatrixABC,
66 			     const gs_cie_render_proc3 * EncodeABC,
67 			     const gs_range3 * RangeABC,
68 			     const gs_cie_render_table_t * RenderTable);
69 /*
70  * Initialize a CRD without the option of copying cached values.
71  */
72 int
73     gs_cie_render1_initialize(const gs_memory_t *mem,
74 			      gs_cie_render *pcrd,
75 			      void *client_data,
76 			      const gs_vector3 * WhitePoint,
77 			      const gs_vector3 * BlackPoint,
78 			      const gs_matrix3 * MatrixPQR,
79 			      const gs_range3 * RangePQR,
80 			      const gs_cie_transform_proc3 * TransformPQR,
81 			      const gs_matrix3 * MatrixLMN,
82 			      const gs_cie_render_proc3 * EncodeLMN,
83 			      const gs_range3 * RangeLMN,
84 			      const gs_matrix3 * MatrixABC,
85 			      const gs_cie_render_proc3 * EncodeABC,
86 			      const gs_range3 * RangeABC,
87 			      const gs_cie_render_table_t * RenderTable);
88 
89 /*
90  * Set or access the client_data pointer in a CRD.
91  * The macro is an L-value.
92  */
93 #define gs_cie_render_client_data(pcrd) ((pcrd)->client_data)
94 
95 #endif /* gscrd_INCLUDED */
96