comparison mupdf-source/include/mupdf/fitz/separation.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 // Copyright (C) 2004-2021 Artifex Software, Inc.
2 //
3 // This file is part of MuPDF.
4 //
5 // MuPDF is free software: you can redistribute it and/or modify it under the
6 // terms of the GNU Affero General Public License as published by the Free
7 // Software Foundation, either version 3 of the License, or (at your option)
8 // any later version.
9 //
10 // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Affero General Public License
16 // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17 //
18 // Alternative licensing terms are available from the licensor.
19 // For commercial licensing, see <https://www.artifex.com/> or contact
20 // Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21 // CA 94129, USA, for further information.
22
23 #ifndef MUPDF_FITZ_SEPARATION_H
24 #define MUPDF_FITZ_SEPARATION_H
25
26 #include "mupdf/fitz/system.h"
27 #include "mupdf/fitz/context.h"
28 #include "mupdf/fitz/color.h"
29
30 /**
31 A fz_separation structure holds details of a set of separations
32 (such as might be used on within a page of the document).
33
34 The app might control the separations by enabling/disabling them,
35 and subsequent renders would take this into account.
36 */
37
38 enum
39 {
40 FZ_MAX_SEPARATIONS = 64
41 };
42
43 typedef struct fz_separations fz_separations;
44
45 typedef enum
46 {
47 /* "Composite" separations are rendered using process
48 * colors using the equivalent colors */
49 FZ_SEPARATION_COMPOSITE = 0,
50 /* Spot colors are rendered into their own spot plane. */
51 FZ_SEPARATION_SPOT = 1,
52 /* Disabled colors are not rendered at all in the final
53 * output. */
54 FZ_SEPARATION_DISABLED = 2
55 } fz_separation_behavior;
56
57 /**
58 Create a new separations structure (initially empty)
59 */
60 fz_separations *fz_new_separations(fz_context *ctx, int controllable);
61
62 /**
63 Increment the reference count for a separations structure.
64 Returns the same pointer.
65
66 Never throws exceptions.
67 */
68 fz_separations *fz_keep_separations(fz_context *ctx, fz_separations *sep);
69
70 /**
71 Decrement the reference count for a separations structure.
72 When the reference count hits zero, the separations structure
73 is freed.
74
75 Never throws exceptions.
76 */
77 void fz_drop_separations(fz_context *ctx, fz_separations *sep);
78
79 /**
80 Add a separation (null terminated name, colorspace)
81 */
82 void fz_add_separation(fz_context *ctx, fz_separations *sep, const char *name, fz_colorspace *cs, int cs_channel);
83
84 /**
85 Add a separation with equivalents (null terminated name,
86 colorspace)
87
88 (old, deprecated)
89 */
90 void fz_add_separation_equivalents(fz_context *ctx, fz_separations *sep, uint32_t rgba, uint32_t cmyk, const char *name);
91
92 /**
93 Control the rendering of a given separation.
94 */
95 void fz_set_separation_behavior(fz_context *ctx, fz_separations *sep, int separation, fz_separation_behavior behavior);
96
97 /**
98 Test for the current behavior of a separation.
99 */
100 fz_separation_behavior fz_separation_current_behavior(fz_context *ctx, const fz_separations *sep, int separation);
101
102 const char *fz_separation_name(fz_context *ctx, const fz_separations *sep, int separation);
103 int fz_count_separations(fz_context *ctx, const fz_separations *sep);
104
105 /**
106 Return the number of active separations.
107 */
108 int fz_count_active_separations(fz_context *ctx, const fz_separations *seps);
109
110 /**
111 Compare 2 separations structures (or NULLs).
112
113 Return 0 if identical, non-zero if not identical.
114 */
115 int fz_compare_separations(fz_context *ctx, const fz_separations *sep1, const fz_separations *sep2);
116
117
118 /**
119 Return a separations object with all the spots in the input
120 separations object that are set to composite, reset to be
121 enabled. If there ARE no spots in the object, this returns
122 NULL. If the object already has all its spots enabled, then
123 just returns another handle on the same object.
124 */
125 fz_separations *fz_clone_separations_for_overprint(fz_context *ctx, fz_separations *seps);
126
127 /**
128 Convert a color given in terms of one colorspace,
129 to a color in terms of another colorspace/separations.
130 */
131 void fz_convert_separation_colors(fz_context *ctx, fz_colorspace *src_cs, const float *src_color, fz_separations *dst_seps, fz_colorspace *dst_cs, float *dst_color, fz_color_params color_params);
132
133 /**
134 Get the equivalent separation color in a given colorspace.
135 */
136 void fz_separation_equivalent(fz_context *ctx, const fz_separations *seps, int idx, fz_colorspace *dst_cs, float *dst_color, fz_colorspace *prf, fz_color_params color_params);
137
138 #endif