summaryrefslogtreecommitdiff
path: root/xicc/xdevlin.h
blob: 7e51e408d71e3a5745525e23edad44a20baffc1e (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef XDEVLIN_H
#define XDEVLIN_H
/* 
 * International Color Consortium color transform expanded support
 *
 * Author:  Graeme W. Gill
 * Date:    29/8/01
 * Version: 1.00
 *
 * Copyright 2001 Graeme W. Gill
 * All rights reserved.
 * This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
 * see the License.txt file for licencing details.
 *
 */

/*
 * This class handles the creation of device chanel linearisation
 * curves, given a callback function that maps the device chanels
 * to the value that should be linearised.
 *
 * This class is independent of other icc or icx classes.
 *
 * Its usual use is to create an Lab linerisation curve
 * for native XYZ profiles.
 */

/* The device linearisation class */
struct _xdevlin {

	/* Private: */
	int di;					/* Device dimentionality */
	rspl *curves[MXDI];		/* di Linearisation curves */
	double clipc[MXDI];		/* center of device range */
	double min[MXDI], max[MXDI];	/* Device chanel min/max */
	int pol;				/* Polarity, 0 for minimise other chanels */
	int setch;				/* Chanel to set */
	double lmin, lmax;		/* Linear min & max to rescale */
	void *lucntx;			/* Lookup context */
	void (*lookup) (void *lucntx, double *lin, double *dev);	/* Callback function */

	/* Public: */
	void (*del)(struct _xdevlin *p);

	/* Return the linearisation values given the device values */
	void (*lin)(struct _xdevlin *p, double *out, double *in);

	/* Return the inverse linearisation */
	void (*invlin)(struct _xdevlin *p, double *out, double *in);

}; typedef struct _xdevlin xdevlin;

xdevlin *new_xdevlin(
	int di,				/* Device dimenstionality */
	double *min, double *max,	/* Min & max range of device values, NULL = 0.0 - 1.0 */ 
	void *cntx,			/* Context for callback */
	void (*lookup) (void *cntx, double lin[MXDO], double dev[MXDI])
						/* Callback function, return linear parameter as lin[0] */
);

#endif /* XDEVLIN_H */