ICF 3.1.1.10
Technical documentation of ICF Libraries
CLab.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// ICF includes
10#include <iser/IArchive.h>
11#include <icmm/TComposedColor.h>
12
13
14namespace icmm
15{
16
17
22class CLab: public TComposedColor<3>
23{
24public:
26
33
34 CLab(double l = 0.0, double a = 0.0, double b = 0.0);
35 CLab(const CLab& color);
36
37 // access to component values
38 double GetL() const;
39 void SetL(double value);
40 double GetA() const;
41 void SetA(double value);
42 double GetB() const;
43 void SetB(double value);
44
45 bool Serialize(iser::IArchive& archive);
46
47 double GetDeltaE(const CLab& lab) const;
48
49 // operators
50 CLab operator+(const CLab& color) const;
51 CLab operator-(const CLab& color) const;
52 CLab operator*(const CLab& color) const;
53 CLab operator/(const CLab& color) const;
54
55 CLab operator*(double value) const;
56 CLab operator/(double value) const;
57
58 CLab& operator=(const CLab& color);
59
60 const CLab& operator+=(const CLab& color);
61 const CLab& operator-=(const CLab& color);
62 const CLab& operator*=(const CLab& color);
63 const CLab& operator/=(const CLab& color);
64
65 const CLab& operator*=(double value);
66 const CLab& operator/=(double value);
67};
68
69
70// inline methods
71
72inline CLab::CLab(double l, double a, double b)
73{
74 SetElement(CI_L, l);
75 SetElement(CI_A, a);
76 SetElement(CI_B, b);
77}
78
79
80inline CLab::CLab(const CLab& color)
81: BaseClass(color)
82{
83}
84
85
86// access to components
87
88inline double CLab::GetL() const
89{
90 return GetElement(CI_L);
91}
92
93
94inline void CLab::SetL(double value)
95{
96 SetElement(CI_L, value);
97}
98
99
100inline double CLab::GetA() const
101{
102 return GetElement(CI_A);
103}
104
105
106inline void CLab::SetA(double value)
107{
108 SetElement(CI_A, value);
109}
110
111
112inline double CLab::GetB() const
113{
114 return GetElement(CI_B);
115}
116
117
118inline void CLab::SetB(double value)
119{
120 SetElement(CI_B, value);
121}
122
123
124// operators
125
126inline CLab CLab::operator+(const CLab& color) const
127{
128 CLab retVal = *this;
129
130 retVal += color;
131
132 return retVal;
133}
134
135
136inline CLab CLab::operator-(const CLab& color) const
137{
138 CLab retVal = *this;
139
140 retVal -= color;
141
142 return retVal;
143}
144
145
146inline CLab CLab::operator*(const CLab& color) const
147{
148 CLab retVal = *this;
149
150 retVal *= color;
151
152 return retVal;
153}
154
155
156inline CLab CLab::operator/(const CLab& color) const
157{
158 CLab retVal = *this;
159
160 retVal /= color;
161
162 return retVal;
163}
164
165
166inline CLab CLab::operator*(double value) const
167{
168 CLab retVal = *this;
169
170 retVal *= value;
171
172 return retVal;
173}
174
175
176inline CLab CLab::operator/(double value) const
177{
178 CLab retVal = *this;
179
180 retVal /= value;
181
182 return retVal;
183}
184
185
186inline CLab& CLab::operator=(const CLab& color)
187{
189
190 return *this;
191}
192
193
194inline const CLab& CLab::operator+=(const CLab& color)
195{
197
198 return *this;
199}
200
201
202inline const CLab& CLab::operator-=(const CLab& color)
203{
205
206 return *this;
207}
208
209
210inline const CLab& CLab::operator*=(const CLab& color)
211{
213
214 return *this;
215}
216
217
218inline const CLab& CLab::operator/=(const CLab& color)
219{
221
222 return *this;
223}
224
225
226inline const CLab& CLab::operator*=(double value)
227{
229
230 return *this;
231}
232
233
234inline const CLab& CLab::operator/=(double value)
235{
237
238 return *this;
239}
240
241
242} // namespace icmm
243
244
Primitive for representation of LAB color value.
Definition CLab.h:23
bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
double GetA() const
Definition CLab.h:100
const CLab & operator+=(const CLab &color)
Definition CLab.h:194
const CLab & operator-=(const CLab &color)
Definition CLab.h:202
double GetB() const
Definition CLab.h:112
const CLab & operator/=(const CLab &color)
Definition CLab.h:218
CLab & operator=(const CLab &color)
Definition CLab.h:186
TComposedColor< 3 > BaseClass
Definition CLab.h:25
double GetL() const
Definition CLab.h:88
CLab operator/(const CLab &color) const
Definition CLab.h:156
void SetL(double value)
Definition CLab.h:94
ComponentIndex
Definition CLab.h:28
@ CI_A
Definition CLab.h:30
@ CI_L
Definition CLab.h:29
@ CI_B
Definition CLab.h:31
void SetB(double value)
Definition CLab.h:118
CLab operator+(const CLab &color) const
Definition CLab.h:126
CLab operator*(const CLab &color) const
Definition CLab.h:146
double GetDeltaE(const CLab &lab) const
void SetA(double value)
Definition CLab.h:106
CLab(double l=0.0, double a=0.0, double b=0.0)
Definition CLab.h:72
const CLab & operator*=(const CLab &color)
Definition CLab.h:210
Generic color implementation.
const TComposedColor< Size > & operator=(const TComposedColor< Size > &color)
const TComposedColor< Size > & operator+=(const TComposedColor< Size > &color)
const TComposedColor< Size > & operator-=(const TComposedColor< Size > &color)
const TComposedColor< Size > & operator*=(const TComposedColor< Size > &color)
const TComposedColor< Size > & operator/=(const TComposedColor< Size > &color)
TVector< Size, Element > operator-() const
Definition TVector.h:541
void SetElement(int i, const Element &value)
Set element at specified i.
Definition TVector.h:266
const Element & GetElement(int i) const
Get element at specified i.
Definition TVector.h:252
Represent input/output persistence archive.
Definition IArchive.h:34
Contains color management classes.
Definition CCmy.h:15

© Witold Gantzke and Kirill Lepskiy