summaryrefslogtreecommitdiff
path: root/source/fitz/colorspace-imp.h
blob: 52042d4e3a08d48df46e030abe52d221108a1bc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef MUPDF_FITZ_COLORSPACE_IMP_H
#define MUPDF_FITZ_COLORSPACE_IMP_H

#include "mupdf/fitz/context.h"
#include "mupdf/fitz/colorspace.h"
#include "mupdf/fitz/color-management.h"
#include "mupdf/fitz/pixmap.h"

void fz_cmm_transform_pixmap(fz_context *ctx, fz_icclink *link, fz_pixmap *dst, fz_pixmap *src);
void fz_cmm_transform_color(fz_context *ctx, fz_icclink *link, unsigned short *dst, const unsigned short *src);
void fz_cmm_init_link(fz_context *ctx, fz_icclink *link, const fz_iccprofile *dst, int dst_extras, const fz_iccprofile *src, int src_extras, const fz_iccprofile *prf, const fz_color_params *rend, int cmm_flags, int num_bytes, int copy_spots);
void fz_cmm_fin_link(fz_context *ctx, fz_icclink *link);
fz_cmm_instance *fz_cmm_new_instance(fz_context *ctx);
void fz_cmm_drop_instance(fz_context *ctx);
void fz_cmm_init_profile(fz_context *ctx, fz_iccprofile *profile);
void fz_cmm_fin_profile(fz_context *ctx, fz_iccprofile *profile);

enum
{
	FZ_CS_HAS_CMYK = (FZ_COLORSPACE_LAST_PUBLIC_FLAG<<1),
	FZ_CS_HAS_SPOTS = (FZ_COLORSPACE_LAST_PUBLIC_FLAG<<2),
	FZ_CS_HAS_CMYK_AND_SPOTS = FZ_CS_HAS_CMYK|FZ_CS_HAS_SPOTS
};

struct fz_colorspace_s
{
	fz_key_storable key_storable;
	size_t size;
	char *name;
	enum fz_colorspace_type type;
	int flags;
	int n;
	fz_colorspace_convert_fn *to_ccs;
	fz_colorspace_convert_fn *from_ccs;
	fz_colorspace_clamp_fn *clamp;
	fz_colorspace_base_fn *get_base;
	fz_colorspace_destruct_fn *free_data;
	void *data;
	char *colorant[FZ_MAX_COLORS];
};

struct fz_iccprofile_s
{
	char *desc;
	int num_devcomp;
	int bgr;
	fz_buffer *buffer;
	unsigned char md5[16];
	void *cmm_handle;
};

struct fz_icclink_s
{
	fz_storable storable;
	int depth;
	int src_extras;
	int dst_extras;
	int copy_spots;
	int is_identity;
	void *cmm_handle;
};

struct fz_default_colorspaces_s
{
	int refs;
	fz_colorspace *gray;
	fz_colorspace *rgb;
	fz_colorspace *cmyk;
	fz_colorspace *oi;
};

struct fz_colorspace_context_s
{
	int ctx_refs;
	const fz_cmm_engine *cmm;
	fz_colorspace *gray, *rgb, *bgr, *cmyk, *lab;
};

#endif