Coverage Report

Created: 2025-06-10 06:58

/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
82.0k
{
57
82.0k
    os_ptr op = osp;
58
59
82.0k
    push(1);
60
82.0k
    make_bool(op, gs_currentoverprint(igs));
61
82.0k
    return 0;
62
82.0k
}
63
64
/* <bool> setoverprint - */
65
static int
66
zsetoverprint(i_ctx_t *i_ctx_p)
67
164k
{
68
164k
    os_ptr op = osp;
69
70
164k
    check_op(1);
71
164k
    check_type(*op, t_boolean);
72
164k
    gs_setoverprint(igs, op->value.boolval);
73
164k
    pop(1);
74
164k
    return 0;
75
164k
}
76
77
/* - currentstrokeoverprint <bool> */
78
static int
79
zcurrentstrokeoverprint(i_ctx_t *i_ctx_p)
80
0
{
81
0
    os_ptr op = osp;
82
83
0
    push(1);
84
0
    make_bool(op, gs_currentstrokeoverprint(igs));
85
0
    return 0;
86
0
}
87
88
/* <bool> setstrokeoverprint - */
89
static int
90
zsetstrokeoverprint(i_ctx_t *i_ctx_p)
91
0
{
92
0
    os_ptr op = osp;
93
94
0
    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
0
{
105
0
    os_ptr op = osp;
106
107
0
    push(1);
108
0
    make_bool(op, gs_currentfilloverprint(igs));
109
0
    return 0;
110
0
}
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
8
{
140
8
    os_ptr op = osp;
141
8
    int param;
142
8
    int code;
143
144
8
    check_op(1);
145
8
    code = int_param(op, max_int, &param);
146
147
8
    if (code < 0 || (code = gs_setoverprintmode(igs, param)) < 0)
148
1
        return code;
149
7
    pop(1);
150
7
    return 0;
151
8
}
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
};