1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #ifndef SCCOLORMGMTSTRUCTS_H
9 #define SCCOLORMGMTSTRUCTS_H
10 
11 #include <QString>
12 
13 // If you change that enum do not forget to update functions
14 // colorFormatType() and colorFormatHasAlpha()
15 enum eColorFormat
16 {
17 	Format_Undefined,
18 	Format_RGB_8,
19 	Format_RGB_16,
20 	Format_RGBA_8,
21 	Format_RGBA_16,
22 	Format_ARGB_8,
23 	Format_ARGB_16,
24 	Format_BGRA_8,
25 	Format_BGRA_16,
26 	Format_CMYK_8,
27 	Format_CMYK_16,
28 	Format_CMYKA_8,
29 	Format_CMYKA_16,
30 	Format_YMCK_8,
31 	Format_YMCK_16,
32 	Format_GRAY_8,
33 	Format_GRAY_16,
34 	Format_LabA_8,
35 	Format_Lab_Dbl
36 };
37 
38 enum eColorType
39 {
40 	Color_Unknown,
41 	Color_RGB,
42 	Color_CMYK,
43 	Color_Gray,
44 	Color_Lab
45 };
46 
47 enum eColorTransformFlags
48 {
49 	Ctf_BlackPointCompensation = 1,
50 	Ctf_BlackPreservation      = 2,
51 	Ctf_Softproofing           = 4,
52 	Ctf_GamutCheck             = 8
53 };
54 
55 enum eRenderIntent
56 {
57 	Intent_Perceptual = 0,
58 	Intent_Relative_Colorimetric = 1,
59 	Intent_Saturation = 2,
60 	Intent_Absolute_Colorimetric = 3,
61 	Intent_Max = 4
62 };
63 
64 enum eColorSpaceType
65 {
66 	ColorSpace_Unknown,
67 	ColorSpace_XYZ,
68 	ColorSpace_Lab,
69 	ColorSpace_Luv,
70 	ColorSpace_YCbCr,
71 	ColorSpace_Yxy,
72 	ColorSpace_Rgb,
73 	ColorSpace_Gray,
74 	ColorSpace_Hsv,
75 	ColorSpace_Hls,
76 	ColorSpace_Cmyk,
77 	ColorSpace_Cmy
78 };
79 
80 enum eProfileClass
81 {
82 	Class_Unknown,
83 	Class_Input,
84 	Class_Display,
85 	Class_Output,
86 	Class_Link,
87 	Class_Abstract,
88 	Class_ColorSpace,
89 	Class_NamedColor
90 };
91 
92 enum eIlluminant
93 {
94 	Illuminant_D50,
95 	Illuminant_D65
96 };
97 
98 enum eObserver
99 {
100 	Observer_2deg,
101 	Observer_10deg
102 };
103 
104 class ScColorMgmtStrategy
105 {
106 	public:
107 		bool useBlackPointCompensation() const;
108 		void setUseBlackPointCompensation(bool useBlackPointCompensation);
109 		bool useBlackPreservation() const;
110 		void setUseBlackPreservation(bool useBlackPreservation);
111 
112 	private:
113 		bool m_useBlackPointCompensation {true};
114 		bool m_useBlackPreservation {false};
115 };
116 
117 struct ScColorProfileInfo
118 {
119 	QString file;
120 	QString description;
121 	eColorSpaceType colorSpace;
122 	eProfileClass   deviceClass;
123 	QString debug;
124 };
125 
126 struct ScColorTransformInfo
127 {
128 	QString inputProfile;
129 	QString outputProfile;
130 	QString proofingProfile;
131 	eColorFormat inputFormat;
132 	eColorFormat outputFormat;
133 	eRenderIntent renderIntent;
134 	eRenderIntent proofingIntent;
135 	long flags;
136 };
137 
138 bool operator==(const ScColorTransformInfo& v1, const ScColorTransformInfo& v2);
139 
140 struct ScXYZ
141 {
142 	double X;
143 	double Y;
144 	double Z;
145 };
146 
147 struct ScLab
148 {
149 	double L;
150 	double a;
151 	double b;
152 };
153 
154 eColorType colorFormatType(eColorFormat format);
155 uint       colorFormatNumChannels(eColorFormat format);
156 uint       colorFormatBytesPerChannel(eColorFormat format);
157 bool       colorFormatHasAlpha(eColorFormat format);
158 
159 #endif
160