Debian Codegraph @

libs/pigment/colorprofiles/KoDummyColorProfile.cpp

raw
1 /*
2 * SPDX-FileCopyrightText: 2010 Cyrille Berger <[email protected]>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7 #include "KoDummyColorProfile.h"
8
9 KoDummyColorProfile::KoDummyColorProfile()
10 {
11 setName("default");
12 }
13
14 KoDummyColorProfile::~KoDummyColorProfile()
15 {
16 }
17
18 KoColorProfile* KoDummyColorProfile::clone() const
19 {
20 return new KoDummyColorProfile();
21 }
22
23 bool KoDummyColorProfile::valid() const
24 {
25 return true;
26 }
27 float KoDummyColorProfile::version() const
28 {
29 return 0.0;
30 }
31 bool KoDummyColorProfile::isSuitableForOutput() const
32 {
33 return true;
34 }
35 bool KoDummyColorProfile::isSuitableForInput() const
36 {
37 return true;
38 }
39 bool KoDummyColorProfile::isSuitableForWorkspace() const
40 {
41 return true;
42 }
43
44 bool KoDummyColorProfile::isSuitableForPrinting() const
45 {
46 return true;
47 }
48
49 bool KoDummyColorProfile::isSuitableForDisplay() const
50 {
51 return true;
52 }
53 bool KoDummyColorProfile::supportsPerceptual() const
54 {
55 return true;
56 }
57 bool KoDummyColorProfile::supportsSaturation() const
58 {
59 return true;
60 }
61 bool KoDummyColorProfile::supportsAbsolute() const
62 {
63 return true;
64 }
65 bool KoDummyColorProfile::supportsRelative() const
66 {
67 return true;
68 }
69 bool KoDummyColorProfile::hasColorants() const
70 {
71 return true;
72 }
73 bool KoDummyColorProfile::hasTRC() const
74 {
75 return true;
76 }
77 bool KoDummyColorProfile::isLinear() const
78 {
79 return true;
80 }
81 QVector<double> KoDummyColorProfile::getColorantsXYZ() const
82 {
83 QVector<double> sRGBStandardAdaptedColorants = {
84 0.43603516, 0.22248840, 0.01391602,
85 0.38511658, 0.71690369, 0.09706116,
86 0.14305115, 0.06060791, 0.71392822
87 };
88 return sRGBStandardAdaptedColorants;
89 }
90
91 QVector<double> KoDummyColorProfile::getColorantsxyY() const
92 {
93 QVector<double> result(9);
94 auto srgb = getColorantsXYZ();
95 result[0] = srgb[0] / (srgb[0] + srgb[1] + srgb[2]);
96 result[1] = srgb[1] / (srgb[0] + srgb[1] + srgb[2]);
97 result[2] = srgb[1];
98
99 result[3] = srgb[3] / (srgb[3] + srgb[4] + srgb[5]);
100 result[4] = srgb[4] / (srgb[3] + srgb[4] + srgb[5]);
101 result[5] = srgb[4];
102
103 result[6] = srgb[6] / (srgb[6] + srgb[7] + srgb[8]);
104 result[7] = srgb[7] / (srgb[6] + srgb[7] + srgb[8]);
105 result[8] = srgb[7];
106
107 return result;
108 }
109
110 QVector<double> KoDummyColorProfile::getWhitePointXYZ() const
111 {
112 QVector<double> d50Dummy;
113 d50Dummy<<0.9642<<1.0000<<0.8249;
114 return d50Dummy;
115 }
116
117 QVector<double> KoDummyColorProfile::getWhitePointxyY() const
118 {
119 QVector<double> d50Dummy;
120 d50Dummy<<0.34773<<0.35952<<1.0;
121 return d50Dummy;
122 }
123
124 QVector <double> KoDummyColorProfile::getEstimatedTRC() const
125
126 {
127 QVector<double> Dummy(3);
128 Dummy.fill(2.2);
129 return Dummy;
130 }
131
132 bool KoDummyColorProfile::compareTRC(TransferCharacteristics, float) const
133 {
134 return false;
135 }
136
137 void KoDummyColorProfile::linearizeFloatValue(QVector <double> & ) const
138 {
139 }
140
141 void KoDummyColorProfile::delinearizeFloatValue(QVector <double> & ) const
142 {
143 }
144 void KoDummyColorProfile::linearizeFloatValueFast(QVector <double> & ) const
145 {
146 }
147
148 void KoDummyColorProfile::delinearizeFloatValueFast(QVector <double> & ) const
149 {
150 }
151 bool KoDummyColorProfile::operator==(const KoColorProfile& rhs) const
152 {
153 return dynamic_cast<const KoDummyColorProfile*>(&rhs);
154 }
155
156 QByteArray KoDummyColorProfile::uniqueId() const
157 {
158 return QByteArray();
159 }
160