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: zcolor3.c 9043 2008-08-28 22:48:19Z giles $*/
15 /* Level 3 color operators */
16 #include "ghost.h"
17 #include "oper.h"
18 #include "igstate.h"
19 #include "store.h"
20
21
22 /*
23 * <bool> .setuseciecolor -
24 *
25 * Set the use_cie_color parameter for the interpreter state, which
26 * corresponds to the UseCIEColor page device parameter. This parameter
27 * may be read at all language levels, but it may be set only for
28 * language level 3. The parameter is handled separately from the page
29 * device dictionary primarily for performance reasons (it may need to
30 * be checked frequently), but also to ensure proper language level
31 * specific behavior.
32 *
33 * This operator is accessible only during initialization and is called
34 * only under controlled conditions. Hence, it does not do any operand
35 * checking.
36 */
37 static int
zsetuseciecolor(i_ctx_t * i_ctx_p)38 zsetuseciecolor(i_ctx_t * i_ctx_p)
39 {
40 os_ptr op = osp;
41
42 istate->use_cie_color = *op;
43 pop(1);
44 return 0;
45 }
46
47 /* - .currentrenderingintent <int> */
48 static int
zcurrentrenderingintent(i_ctx_t * i_ctx_p)49 zcurrentrenderingintent(i_ctx_t *i_ctx_p)
50 {
51 os_ptr op = osp;
52
53 push(1);
54 make_int(op, gs_currentrenderingintent(igs));
55 return 0;
56 }
57
58 /* <int> .setrenderingintent -
59 * See the comment in gsstate.c about the argumet interepretation.
60 */
61 static int
zsetrenderingintent(i_ctx_t * i_ctx_p)62 zsetrenderingintent(i_ctx_t * i_ctx_p)
63 {
64 os_ptr op = osp;
65 int param;
66 int code = int_param(op, max_int, ¶m);
67
68 if (code < 0 || (code = gs_setrenderingintent(igs, param)) < 0)
69 return code;
70 pop(1);
71 return 0;
72 }
73
74 /*
75 * Initialization procedure
76 */
77
78 const op_def zcolor3_l3_op_defs[] = {
79 op_def_begin_ll3(),
80 { "0.setuseciecolor", zsetuseciecolor },
81 { "0.currentrenderintent", zcurrentrenderingintent },
82 { "1.setrenderingintent", zsetrenderingintent },
83 op_def_end(0)
84 };
85