/src/ghostpdl/psi/zcssepr.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (C) 2001-2021 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 | | /* 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 | 538k | { |
57 | 538k | os_ptr op = osp; |
58 | | |
59 | 538k | push(1); |
60 | 538k | make_bool(op, gs_currentoverprint(igs)); |
61 | 538k | return 0; |
62 | 538k | } |
63 | | |
64 | | /* <bool> setoverprint - */ |
65 | | static int |
66 | | zsetoverprint(i_ctx_t *i_ctx_p) |
67 | 1.07M | { |
68 | 1.07M | os_ptr op = osp; |
69 | | |
70 | 1.07M | check_type(*op, t_boolean); |
71 | 1.07M | gs_setoverprint(igs, op->value.boolval); |
72 | 1.07M | pop(1); |
73 | 1.07M | return 0; |
74 | 1.07M | } |
75 | | |
76 | | /* - currentstrokeoverprint <bool> */ |
77 | | static int |
78 | | zcurrentstrokeoverprint(i_ctx_t *i_ctx_p) |
79 | 3 | { |
80 | 3 | os_ptr op = osp; |
81 | | |
82 | 3 | push(1); |
83 | 3 | make_bool(op, gs_currentstrokeoverprint(igs)); |
84 | 3 | return 0; |
85 | 3 | } |
86 | | |
87 | | /* <bool> setstrokeoverprint - */ |
88 | | static int |
89 | | zsetstrokeoverprint(i_ctx_t *i_ctx_p) |
90 | 5 | { |
91 | 5 | os_ptr op = osp; |
92 | | |
93 | 5 | check_type(*op, t_boolean); |
94 | 0 | gs_setstrokeoverprint(igs, op->value.boolval); |
95 | 0 | pop(1); |
96 | 0 | return 0; |
97 | 5 | } |
98 | | |
99 | | /* - currentfilloverprint <bool> */ |
100 | | static int |
101 | | zcurrentfilloverprint(i_ctx_t *i_ctx_p) |
102 | 6 | { |
103 | 6 | os_ptr op = osp; |
104 | | |
105 | 6 | push(1); |
106 | 6 | make_bool(op, gs_currentfilloverprint(igs)); |
107 | 6 | return 0; |
108 | 6 | } |
109 | | |
110 | | /* <bool> setfilloverprint - */ |
111 | | static int |
112 | | zsetfilloverprint(i_ctx_t *i_ctx_p) |
113 | 2 | { |
114 | 2 | os_ptr op = osp; |
115 | | |
116 | 2 | check_type(*op, t_boolean); |
117 | 0 | gs_setfilloverprint(igs, op->value.boolval); |
118 | 0 | pop(1); |
119 | 0 | return 0; |
120 | 2 | } |
121 | | |
122 | | /* - .currentoverprintmode <int> */ |
123 | | static int |
124 | | zcurrentoverprintmode(i_ctx_t *i_ctx_p) |
125 | 0 | { |
126 | 0 | os_ptr op = osp; |
127 | |
|
128 | 0 | push(1); |
129 | 0 | make_int(op, gs_currentoverprintmode(igs)); |
130 | 0 | return 0; |
131 | 0 | } |
132 | | |
133 | | /* <int> .setoverprintmode - */ |
134 | | static int |
135 | | zsetoverprintmode(i_ctx_t *i_ctx_p) |
136 | 562 | { |
137 | 562 | os_ptr op = osp; |
138 | 562 | int param; |
139 | 562 | int code = int_param(op, max_int, ¶m); |
140 | | |
141 | 562 | if (code < 0 || (code = gs_setoverprintmode(igs, param)) < 0) |
142 | 8 | return code; |
143 | 554 | pop(1); |
144 | 554 | return 0; |
145 | 562 | } |
146 | | |
147 | | /* ------ Initialization procedure ------ */ |
148 | | |
149 | | const op_def zcssepr_l2_op_defs[] = |
150 | | { |
151 | | op_def_begin_level2(), |
152 | | {"0currentoverprint", zcurrentoverprint}, |
153 | | {"0.currentoverprintmode", zcurrentoverprintmode}, |
154 | | {"1setoverprint", zsetoverprint}, |
155 | | {"1.setoverprintmode", zsetoverprintmode}, |
156 | | {"0.currentstrokeoverprint", zcurrentstrokeoverprint}, |
157 | | {"1.setstrokeoverprint", zsetstrokeoverprint}, |
158 | | {"0.currentfilloverprint", zcurrentfilloverprint}, |
159 | | {"1.setfilloverprint", zsetfilloverprint}, |
160 | | op_def_end(0) |
161 | | }; |