Coverage Report

Created: 2025-06-10 06:49

/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
123k
{
57
123k
    os_ptr op = osp;
58
59
123k
    push(1);
60
123k
    make_bool(op, gs_currentoverprint(igs));
61
123k
    return 0;
62
123k
}
63
64
/* <bool> setoverprint - */
65
static int
66
zsetoverprint(i_ctx_t *i_ctx_p)
67
247k
{
68
247k
    os_ptr op = osp;
69
70
247k
    check_op(1);
71
247k
    check_type(*op, t_boolean);
72
247k
    gs_setoverprint(igs, op->value.boolval);
73
247k
    pop(1);
74
247k
    return 0;
75
247k
}
76
77
/* - currentstrokeoverprint <bool> */
78
static int
79
zcurrentstrokeoverprint(i_ctx_t *i_ctx_p)
80
1
{
81
1
    os_ptr op = osp;
82
83
1
    push(1);
84
1
    make_bool(op, gs_currentstrokeoverprint(igs));
85
1
    return 0;
86
1
}
87
88
/* <bool> setstrokeoverprint - */
89
static int
90
zsetstrokeoverprint(i_ctx_t *i_ctx_p)
91
1
{
92
1
    os_ptr op = osp;
93
94
1
    check_op(1);
95
0
    check_type(*op, t_boolean);
96
0
    gs_setstrokeoverprint(igs, op->value.boolval);
97
0
    pop(1);
98
0
    return 0;
99
0
}
100
101
/* - currentfilloverprint <bool> */
102
static int
103
zcurrentfilloverprint(i_ctx_t *i_ctx_p)
104
1
{
105
1
    os_ptr op = osp;
106
107
1
    push(1);
108
1
    make_bool(op, gs_currentfilloverprint(igs));
109
1
    return 0;
110
1
}
111
112
/* <bool> setfilloverprint - */
113
static int
114
zsetfilloverprint(i_ctx_t *i_ctx_p)
115
0
{
116
0
    os_ptr op = osp;
117
118
0
    check_op(1);
119
0
    check_type(*op, t_boolean);
120
0
    gs_setfilloverprint(igs, op->value.boolval);
121
0
    pop(1);
122
0
    return 0;
123
0
}
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
10
{
140
10
    os_ptr op = osp;
141
10
    int param;
142
10
    int code;
143
144
10
    check_op(1);
145
9
    code = int_param(op, max_int, &param);
146
147
9
    if (code < 0 || (code = gs_setoverprintmode(igs, param)) < 0)
148
0
        return code;
149
9
    pop(1);
150
9
    return 0;
151
9
}
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
};