summaryrefslogtreecommitdiff
path: root/source/fitz/colorspace-imp.h
blob: c4e94f03ab831c5bff7e17592850df59e209b20a (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
#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"

#define FZ_ICC_PROFILE_GRAY "DeviceGray"
#define FZ_ICC_PROFILE_RGB "DeviceRGB"
#define FZ_ICC_PROFILE_BGR "DeviceBGR"
#define FZ_ICC_PROFILE_CMYK "DeviceCMYK"
#define FZ_ICC_PROFILE_LAB "Lab"

int fz_cmm_avoid_white_fix_flag(fz_context *ctx);
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_color_params *rend, int cmm_flags, int num_bytes, int extras, const fz_iccprofile *src, const fz_iccprofile *prf, const fz_iccprofile *des);
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);

struct fz_colorspace_s
{
	fz_storable storable;
	size_t size;
	char name[24];
	unsigned char n;
	unsigned char is_subtractive;
	unsigned char is_device_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
{
	int num_devcomp;
	int bgr;
	fz_buffer *buffer;
	unsigned char md5[16];
	void *cmm_handle;
};

struct fz_icclink_s
{
	fz_storable storable;
	int num_in;
	int num_out;
	int depth;
	int extras;
	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