/src/ghostpdl/psi/zcssepr.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (C) 2001-2023 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., 39 Mesa Street, Suite 108A, San Francisco, |
13 | | CA 94129, USA, for further information. |
14 | | */ |
15 | | |
16 | | |
17 | | /* Separation color space support */ |
18 | | #include "memory_.h" |
19 | | #include "ghost.h" |
20 | | #include "oper.h" |
21 | | #include "gsstruct.h" |
22 | | #include "gscolor.h" |
23 | | #include "gsmatrix.h" /* for gxcolor2.h */ |
24 | | #include "gxcspace.h" |
25 | | #include "gxfixed.h" /* ditto */ |
26 | | #include "gxcolor2.h" |
27 | | #include "estack.h" |
28 | | #include "ialloc.h" |
29 | | #include "icsmap.h" |
30 | | #include "ifunc.h" |
31 | | #include "igstate.h" |
32 | | #include "iname.h" |
33 | | #include "ivmspace.h" |
34 | | #include "store.h" |
35 | | #include "gscsepr.h" |
36 | | #include "gscdevn.h" |
37 | | #include "gxcdevn.h" |
38 | | #include "zht2.h" |
39 | | |
40 | | /* Imported from gscsepr.c */ |
41 | | extern const gs_color_space_type gs_color_space_type_Separation; |
42 | | /* Imported from gscdevn.c */ |
43 | | extern const gs_color_space_type gs_color_space_type_DeviceN; |
44 | | |
45 | | /* |
46 | | * Adobe first created the separation colorspace type and then later created |
47 | | * the DeviceN colorspace. Logically the separation colorspace is the same |
48 | | * as a DeviceN colorspace with a single component, except for the /None and |
49 | | * /All parameter values. We treat the separation colorspace as a DeviceN |
50 | | * colorspace except for the /All case. |
51 | | */ |
52 | | |
53 | | /* - currentoverprint <bool> */ |
54 | | static int |
55 | | zcurrentoverprint(i_ctx_t *i_ctx_p) |
56 | 1.16M | { |
57 | 1.16M | os_ptr op = osp; |
58 | | |
59 | 1.16M | push(1); |
60 | 1.16M | make_bool(op, gs_currentoverprint(igs)); |
61 | 1.16M | return 0; |
62 | 1.16M | } |
63 | | |
64 | | /* <bool> setoverprint - */ |
65 | | static int |
66 | | zsetoverprint(i_ctx_t *i_ctx_p) |
67 | 2.33M | { |
68 | 2.33M | os_ptr op = osp; |
69 | | |
70 | 2.33M | check_op(1); |
71 | 2.33M | check_type(*op, t_boolean); |
72 | 2.33M | gs_setoverprint(igs, op->value.boolval); |
73 | 2.33M | pop(1); |
74 | 2.33M | return 0; |
75 | 2.33M | } |
76 | | |
77 | | /* - currentstrokeoverprint <bool> */ |
78 | | static int |
79 | | zcurrentstrokeoverprint(i_ctx_t *i_ctx_p) |
80 | 10 | { |
81 | 10 | os_ptr op = osp; |
82 | | |
83 | 10 | push(1); |
84 | 10 | make_bool(op, gs_currentstrokeoverprint(igs)); |
85 | 10 | return 0; |
86 | 10 | } |
87 | | |
88 | | /* <bool> setstrokeoverprint - */ |
89 | | static int |
90 | | zsetstrokeoverprint(i_ctx_t *i_ctx_p) |
91 | 6 | { |
92 | 6 | os_ptr op = osp; |
93 | | |
94 | 6 | check_op(1); |
95 | 4 | check_type(*op, t_boolean); |
96 | 0 | gs_setstrokeoverprint(igs, op->value.boolval); |
97 | 0 | pop(1); |
98 | 0 | return 0; |
99 | 4 | } |
100 | | |
101 | | /* - currentfilloverprint <bool> */ |
102 | | static int |
103 | | zcurrentfilloverprint(i_ctx_t *i_ctx_p) |
104 | 7 | { |
105 | 7 | os_ptr op = osp; |
106 | | |
107 | 7 | push(1); |
108 | 7 | make_bool(op, gs_currentfilloverprint(igs)); |
109 | 7 | return 0; |
110 | 7 | } |
111 | | |
112 | | /* <bool> setfilloverprint - */ |
113 | | static int |
114 | | zsetfilloverprint(i_ctx_t *i_ctx_p) |
115 | 1 | { |
116 | 1 | os_ptr op = osp; |
117 | | |
118 | 1 | check_op(1); |
119 | 1 | check_type(*op, t_boolean); |
120 | 0 | gs_setfilloverprint(igs, op->value.boolval); |
121 | 0 | pop(1); |
122 | 0 | return 0; |
123 | 1 | } |
124 | | |
125 | | /* - .currentoverprintmode <int> */ |
126 | | static int |
127 | | zcurrentoverprintmode(i_ctx_t *i_ctx_p) |
128 | 0 | { |
129 | 0 | os_ptr op = osp; |
130 | |
|
131 | 0 | push(1); |
132 | 0 | make_int(op, gs_currentoverprintmode(igs)); |
133 | 0 | return 0; |
134 | 0 | } |
135 | | |
136 | | /* <int> .setoverprintmode - */ |
137 | | static int |
138 | | zsetoverprintmode(i_ctx_t *i_ctx_p) |
139 | 766 | { |
140 | 766 | os_ptr op = osp; |
141 | 766 | int param; |
142 | 766 | int code; |
143 | | |
144 | 766 | check_op(1); |
145 | 762 | code = int_param(op, max_int, ¶m); |
146 | | |
147 | 762 | if (code < 0 || (code = gs_setoverprintmode(igs, param)) < 0) |
148 | 2 | return code; |
149 | 760 | pop(1); |
150 | 760 | return 0; |
151 | 762 | } |
152 | | |
153 | | /* ------ Initialization procedure ------ */ |
154 | | |
155 | | const op_def zcssepr_l2_op_defs[] = |
156 | | { |
157 | | op_def_begin_level2(), |
158 | | {"0currentoverprint", zcurrentoverprint}, |
159 | | {"0.currentoverprintmode", zcurrentoverprintmode}, |
160 | | {"1setoverprint", zsetoverprint}, |
161 | | {"1.setoverprintmode", zsetoverprintmode}, |
162 | | {"0.currentstrokeoverprint", zcurrentstrokeoverprint}, |
163 | | {"1.setstrokeoverprint", zsetstrokeoverprint}, |
164 | | {"0.currentfilloverprint", zcurrentfilloverprint}, |
165 | | {"1.setfilloverprint", zsetfilloverprint}, |
166 | | op_def_end(0) |
167 | | }; |