ACF $AcfVersion:0$
CCmy.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
6#include <iser/IArchive.h>
8
9
10namespace icmm
11{
12
13
18class CCmy: public TComposedColor<3>
19{
20public:
22
30
31 CCmy(double c = 0.0, double m = 0.0, double y = 0.0);
32 CCmy(const CCmy& color);
33
34 // access to component values
35 double GetC() const;
36 void SetC(double value);
37 double GetM() const;
38 void SetM(double value);
39 double GetY() const;
40 void SetY(double value);
41
42 virtual bool Serialize(iser::IArchive& archive) override;
43
44 // operators
45 CCmy operator+(const CCmy& color) const;
46 CCmy operator-(const CCmy& color) const;
47 CCmy operator*(const CCmy& color) const;
48 CCmy operator/(const CCmy& color) const;
49
50 CCmy operator*(double value) const;
51 CCmy operator/(double value) const;
52
53 CCmy& operator=(const CCmy& color);
54
55 const CCmy& operator+=(const CCmy& color);
56 const CCmy& operator-=(const CCmy& color);
57 const CCmy& operator*=(const CCmy& color);
58 const CCmy& operator/=(const CCmy& color);
59
60 const CCmy& operator*=(double value);
61 const CCmy& operator/=(double value);
62};
63
64
65// inline methods
66
67inline CCmy::CCmy(double c, double m, double y)
68{
72}
73
74
75inline CCmy::CCmy(const CCmy& color)
76: BaseClass(color)
77{
78}
79
80
81// access to components
82
83inline double CCmy::GetC() const
84{
85 return GetElement(CI_CYAN);
86}
87
88
89inline void CCmy::SetC(double value)
90{
91 SetElement(CI_CYAN, value);
92}
93
94
95inline double CCmy::GetM() const
96{
97 return GetElement(CI_MAGENTA);
98}
99
100
101inline void CCmy::SetM(double value)
102{
103 SetElement(CI_MAGENTA, value);
104}
105
106
107inline double CCmy::GetY() const
108{
109 return GetElement(CI_YELLOW);
110}
111
112
113inline void CCmy::SetY(double value)
114{
115 SetElement(CI_YELLOW, value);
116}
117
118
119// operators
120
121inline CCmy& CCmy::operator=(const CCmy& color)
122{
124
125 return *this;
126}
127
128
129inline const CCmy& CCmy::operator+=(const CCmy& color)
130{
132
133 return *this;
134}
135
136
137inline const CCmy& CCmy::operator-=(const CCmy& color)
138{
140
141 return *this;
142}
143
144
145inline const CCmy& CCmy::operator*=(const CCmy& color)
146{
148
149 return *this;
150}
151
152
153inline const CCmy& CCmy::operator/=(const CCmy& color)
154{
156
157 return *this;
158}
159
160
161inline const CCmy& CCmy::operator*=(double value)
162{
164
165 return *this;
166}
167
168
169inline const CCmy& CCmy::operator/=(double value)
170{
172
173 return *this;
174}
175
176
177} // namespace icmm
178
179
Primitive for representation of CMY color value.
Definition CCmy.h:19
CCmy operator/(double value) const
void SetC(double value)
Definition CCmy.h:89
CCmy operator*(double value) const
const CCmy & operator/=(const CCmy &color)
Definition CCmy.h:153
void SetM(double value)
Definition CCmy.h:101
CCmy & operator=(const CCmy &color)
Definition CCmy.h:121
double GetC() const
Definition CCmy.h:83
const CCmy & operator*=(const CCmy &color)
Definition CCmy.h:145
double GetY() const
Definition CCmy.h:107
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
CCmy operator+(const CCmy &color) const
const CCmy & operator-=(const CCmy &color)
Definition CCmy.h:137
ComponentIndex
Definition CCmy.h:24
@ CI_LAST
Definition CCmy.h:28
@ CI_MAGENTA
Definition CCmy.h:26
@ CI_CYAN
Definition CCmy.h:25
@ CI_YELLOW
Definition CCmy.h:27
CCmy operator-(const CCmy &color) const
CCmy operator*(const CCmy &color) const
const CCmy & operator+=(const CCmy &color)
Definition CCmy.h:129
double GetM() const
Definition CCmy.h:95
TComposedColor< 3 > BaseClass
Definition CCmy.h:21
CCmy operator/(const CCmy &color) const
CCmy(double c=0.0, double m=0.0, double y=0.0)
Definition CCmy.h:67
void SetY(double value)
Definition CCmy.h:113
Generic fixed-size color implementation template.
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)
void SetElement(int i, const Element &value)
Sets the element at the specified index.
Definition TVector.h:560
const Element & GetElement(int i) const
Gets the element at the specified index (read-only).
Definition TVector.h:546
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Contains color management classes.