ACF $AcfVersion:0$
CCmyk.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
190class CCmyk: public TComposedColor<4>
191{
192public:
194
203
204 CCmyk(double c = 0.0, double m = 0.0, double y = 0.0, double k = 0.0);
205 CCmyk(const CCmyk& color);
206
207 // access to component values
208 double GetC() const;
209 void SetC(double value);
210 double GetM() const;
211 void SetM(double value);
212 double GetY() const;
213 void SetY(double value);
214 double GetK() const;
215 void SetK(double value);
216
217 virtual bool Serialize(iser::IArchive& archive) override;
218
219 // operators
220 CCmyk operator+(const CCmyk& color) const;
221 CCmyk operator-(const CCmyk& color) const;
222 CCmyk operator*(const CCmyk& color) const;
223 CCmyk operator/(const CCmyk& color) const;
224
225 CCmyk operator*(double value) const;
226 CCmyk operator/(double value) const;
227
228 CCmyk& operator=(const CCmyk& color);
229
230 const CCmyk& operator+=(const CCmyk& color);
231 const CCmyk& operator-=(const CCmyk& color);
232 const CCmyk& operator*=(const CCmyk& color);
233 const CCmyk& operator/=(const CCmyk& color);
234
235 const CCmyk& operator*=(double value);
236 const CCmyk& operator/=(double value);
237};
238
239
240// inline methods
241
242inline CCmyk::CCmyk(double c, double m, double y, double k)
243{
248}
249
250
251inline CCmyk::CCmyk(const CCmyk& color)
252: BaseClass(color)
253{
254}
255
256
257// access to components
258
259inline double CCmyk::GetC() const
260{
261 return GetElement(CI_CYAN);
262}
263
264
265inline void CCmyk::SetC(double value)
266{
267 SetElement(CI_CYAN, value);
268}
269
270
271inline double CCmyk::GetM() const
272{
273 return GetElement(CI_MAGENTA);
274}
275
276
277inline void CCmyk::SetM(double value)
278{
279 SetElement(CI_MAGENTA, value);
280}
281
282
283inline double CCmyk::GetY() const
284{
285 return GetElement(CI_YELLOW);
286}
287
288
289inline void CCmyk::SetY(double value)
290{
291 SetElement(CI_YELLOW, value);
292}
293
294
295inline double CCmyk::GetK() const
296{
297 return GetElement(CI_BLACK);
298}
299
300
301inline void CCmyk::SetK(double value)
302{
303 SetElement(CI_BLACK, value);
304}
305
306
307// operators
308
309inline CCmyk CCmyk::operator+(const CCmyk& color) const
310{
311 CCmyk retVal = *this;
312
313 retVal += color;
314
315 return retVal;
316}
317
318
319inline CCmyk CCmyk::operator-(const CCmyk& color) const
320{
321 CCmyk retVal = *this;
322
323 retVal -= color;
324
325 return retVal;
326}
327
328
329inline CCmyk CCmyk::operator*(const CCmyk& color) const
330{
331 CCmyk retVal = *this;
332
333 retVal *= color;
334
335 return retVal;
336}
337
338
339inline CCmyk CCmyk::operator/(const CCmyk& color) const
340{
341 CCmyk retVal = *this;
342
343 retVal /= color;
344
345 return retVal;
346}
347
348
349inline CCmyk CCmyk::operator*(double value) const
350{
351 CCmyk retVal = *this;
352
353 retVal *= value;
354
355 return retVal;
356}
357
358
359inline CCmyk CCmyk::operator/(double value) const
360{
361 CCmyk retVal = *this;
362
363 retVal /= value;
364
365 return retVal;
366}
367
368
369inline CCmyk& CCmyk::operator=(const CCmyk& color)
370{
372
373 return *this;
374}
375
376
377inline const CCmyk& CCmyk::operator+=(const CCmyk& color)
378{
380
381 return *this;
382}
383
384
385inline const CCmyk& CCmyk::operator-=(const CCmyk& color)
386{
388
389 return *this;
390}
391
392
393inline const CCmyk& CCmyk::operator*=(const CCmyk& color)
394{
396
397 return *this;
398}
399
400
401inline const CCmyk& CCmyk::operator/=(const CCmyk& color)
402{
404
405 return *this;
406}
407
408
409inline const CCmyk& CCmyk::operator*=(double value)
410{
412
413 return *this;
414}
415
416
417inline const CCmyk& CCmyk::operator/=(double value)
418{
420
421 return *this;
422}
423
424
425} // namespace icmm
426
427
Primitive for representation of CMYK (Cyan, Magenta, Yellow, Black) color values.
Definition CCmyk.h:191
@ CI_MAGENTA
Definition CCmyk.h:198
@ CI_YELLOW
Definition CCmyk.h:199
TComposedColor< 4 > BaseClass
Definition CCmyk.h:193
CCmyk operator+(const CCmyk &color) const
Definition CCmyk.h:309
const CCmyk & operator-=(const CCmyk &color)
Definition CCmyk.h:385
double GetK() const
Definition CCmyk.h:295
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
void SetC(double value)
Definition CCmyk.h:265
CCmyk operator/(const CCmyk &color) const
Definition CCmyk.h:339
double GetY() const
Definition CCmyk.h:283
CCmyk operator*(const CCmyk &color) const
Definition CCmyk.h:329
double GetM() const
Definition CCmyk.h:271
const CCmyk & operator*=(const CCmyk &color)
Definition CCmyk.h:393
double GetC() const
Definition CCmyk.h:259
const CCmyk & operator/=(const CCmyk &color)
Definition CCmyk.h:401
CCmyk(double c=0.0, double m=0.0, double y=0.0, double k=0.0)
Definition CCmyk.h:242
void SetK(double value)
Definition CCmyk.h:301
void SetM(double value)
Definition CCmyk.h:277
CCmyk & operator=(const CCmyk &color)
Definition CCmyk.h:369
void SetY(double value)
Definition CCmyk.h:289
const CCmyk & operator+=(const CCmyk &color)
Definition CCmyk.h:377
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)
TVector< Size, Element > operator-() const
Definition TVector.h:817
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.