1 #ifndef MUPDF_FITZ_SEPARATION_H
2 #define MUPDF_FITZ_SEPARATION_H
3 
4 #include "mupdf/fitz/system.h"
5 #include "mupdf/fitz/context.h"
6 
7 /**
8 	A fz_separation structure holds details of a set of separations
9 	(such as might be used on within a page of the document).
10 
11 	The app might control the separations by enabling/disabling them,
12 	and subsequent renders would take this into account.
13 */
14 
15 enum
16 {
17 	FZ_MAX_SEPARATIONS = 64
18 };
19 
20 typedef struct fz_separations fz_separations;
21 
22 typedef enum
23 {
24 	/* "Composite" separations are rendered using process
25 	 * colors using the equivalent colors */
26 	FZ_SEPARATION_COMPOSITE = 0,
27 	/* Spot colors are rendered into their own spot plane. */
28 	FZ_SEPARATION_SPOT = 1,
29 	/* Disabled colors are not rendered at all in the final
30 	 * output. */
31 	FZ_SEPARATION_DISABLED = 2
32 } fz_separation_behavior;
33 
34 /**
35 	Create a new separations structure (initially empty)
36 */
37 fz_separations *fz_new_separations(fz_context *ctx, int controllable);
38 
39 /**
40 	Increment the reference count for a separations structure.
41 	Returns the same pointer.
42 
43 	Never throws exceptions.
44 */
45 fz_separations *fz_keep_separations(fz_context *ctx, fz_separations *sep);
46 
47 /**
48 	Decrement the reference count for a separations structure.
49 	When the reference count hits zero, the separations structure
50 	is freed.
51 
52 	Never throws exceptions.
53 */
54 void fz_drop_separations(fz_context *ctx, fz_separations *sep);
55 
56 /**
57 	Add a separation (null terminated name, colorspace)
58 */
59 void fz_add_separation(fz_context *ctx, fz_separations *sep, const char *name, fz_colorspace *cs, int cs_channel);
60 
61 /**
62 	Add a separation with equivalents (null terminated name,
63 	colorspace)
64 
65 	(old, deprecated)
66 */
67 void fz_add_separation_equivalents(fz_context *ctx, fz_separations *sep, uint32_t rgba, uint32_t cmyk, const char *name);
68 
69 /**
70 	Control the rendering of a given separation.
71 */
72 void fz_set_separation_behavior(fz_context *ctx, fz_separations *sep, int separation, fz_separation_behavior behavior);
73 
74 /**
75 	Test for the current behavior of a separation.
76 */
77 fz_separation_behavior fz_separation_current_behavior(fz_context *ctx, const fz_separations *sep, int separation);
78 
79 const char *fz_separation_name(fz_context *ctx, const fz_separations *sep, int separation);
80 int fz_count_separations(fz_context *ctx, const fz_separations *sep);
81 
82 /**
83 	Return the number of active separations.
84 */
85 int fz_count_active_separations(fz_context *ctx, const fz_separations *seps);
86 
87 /**
88 	Return a separations object with all the spots in the input
89 	separations object that are set to composite, reset to be
90 	enabled. If there ARE no spots in the object, this returns
91 	NULL. If the object already has all its spots enabled, then
92 	just returns another handle on the same object.
93 */
94 fz_separations *fz_clone_separations_for_overprint(fz_context *ctx, fz_separations *seps);
95 
96 /**
97 	Convert a color given in terms of one colorspace,
98 	to a color in terms of another colorspace/separations.
99 */
100 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);
101 
102 /**
103 	Get the equivalent separation color in a given colorspace.
104 */
105 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);
106 
107 #endif
108