1 
2 #ifndef _XCAM_H_
3 
4 /*
5  * Abstract interface to color appearance model transforms.
6  *
7  * This is to allow the rest of Argyll to use a default CAM.
8  *
9  * Author:  Graeme W. Gill
10  * Date:    25/7/2004
11  * Version: 1.00
12  *
13  * Copyright 2004 Graeme W. Gill
14  * Please refer to COPYRIGHT file for details.
15  * This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
16  * see the License.txt file for licencing details.
17  */
18 
19 /* ---------------------------------- */
20 
21 /* The range of CAMs supported */
22 typedef enum {
23 	cam_default    = 0,		/* Default CAM */
24 	cam_CIECAM97s3 = 1,		/* CIECAM97, version 3 */
25 	cam_CIECAM02   = 2		/* CIECAM02 */
26 } icxCAM;
27 
28 /* The enumerated viewing conditions: */
29 typedef enum {
30 	vc_notset    = -1,
31 	vc_none      = 0,	/* Figure out from Lv and La */
32 	vc_dark      = 1,
33 	vc_dim       = 2,
34 	vc_average   = 3,
35 	vc_cut_sheet = 4	/* Transparencies on a Light Box */
36 } ViewingCondition;
37 
38 struct _icxcam {
39 /* Public: */
40 	void (*del)(struct _icxcam *s);	/* We're done with it */
41 
42 	/* Always returns 0 */
43 	int (*set_view)(
44 		struct _icxcam *s,
45 		ViewingCondition Ev,	/* Enumerated Viewing Condition */
46 		double Wxyz[3],	/* Reference/Adapted White XYZ (Y scale 1.0) */
47 		double La,		/* Adapting/Surround Luminance cd/m^2 */
48 		double Yb,		/* Luminance of Background relative to reference white (range 0.0 .. 1.0) */
49 		double Lv,		/* Luminance of white in the Viewing/Scene/Image field (cd/m^2) */
50 						/* Ignored if Ev is set */
51 		double Yf,		/* Flare as a fraction of the reference white (range 0.0 .. 1.0) */
52 		double Yg,		/* Glare as a fraction of the adapting/surround (range 0.0 .. 1.0) */
53 		double Gxyz[3],	/* The Glare white coordinates (typically the Ambient color) */
54 		int hk,			/* Flag, NZ to use Helmholtz-Kohlraush effect */
55 		double hkscale	/* HK effect scaling factor */
56 	);
57 
58 	/* Conversions */
59 	int (*XYZ_to_cam)(struct _icxcam *s, double *out, double *in);
60 	int (*cam_to_XYZ)(struct _icxcam *s, double *out, double *in);
61 
62 	/* Debug */
63 	void (*settrace)(struct _icxcam *s, int tracev);
64 
65 /* Private: */
66 	icxCAM tag;			/* Type */
67 	void *p;			/* Pointer to implementation */
68 	double Wxyz[3];		/* Copy of Wxyz */
69 
70 }; typedef struct _icxcam icxcam;
71 
72 /* Create a new CAM conversion object */
73 icxcam *new_icxcam(icxCAM which);
74 
75 /* Return the default CAM */
76 icxCAM icxcam_default();
77 
78 /* Return a string describing the given CAM */
79 char *icxcam_description(icxCAM ct);
80 
81 #define _XCAM_H_
82 #endif /* _XCAM_H_ */
83 
84 
85