Krita

Swatch.cpp
1 /*
2  * SPDX-License-Identifier: GPL-3.0-or-later
3  */
4 
5 #include "Swatch.h"
6 
7 #include <KisSwatch.h>
8 #include <KoColor.h>
9 
10 struct Swatch::Private {
11  KisSwatch swatch;
12 };
13 
14 Swatch::Swatch(const KisSwatch &kisSwatch)
15  : d(new Private)
16 {
17  d->swatch = kisSwatch;
18 }
19 
20 Swatch::Swatch()
21  : d(new Private)
22 {
23 
24 }
25 
26 Swatch::~Swatch()
27 {
28  delete d;
29 }
30 
31 Swatch::Swatch(const Swatch &rhs)
32  : d(new Private)
33 {
34  d->swatch = rhs.d->swatch;
35 }
36 
37 Swatch &Swatch::operator=(const Swatch &rhs)
38 {
39  if (&rhs == this) return *this;
40  d->swatch = rhs.d->swatch;
41  return *this;
42 }
43 
44 QString Swatch::name() const
45 {
46  return d->swatch.name();
47 }
48 
49 void Swatch::setName(const QString &name)
50 {
51  d->swatch.setName(name);
52 }
53 
54 QString Swatch::id() const
55 {
56  return d->swatch.id();
57 }
58 void Swatch::setId(const QString &id)
59 {
60  d->swatch.setId(id);
61 }
62 
63 ManagedColor *Swatch::color() const
64 {
65  ManagedColor *c = new ManagedColor(d->swatch.color());
66  return c;
67 }
68 void Swatch::setColor(ManagedColor *color)
69 {
70  d->swatch.setColor(color->color());
71 }
72 
73 bool Swatch::spotColor() const
74 {
75  return d->swatch.spotColor();
76 }
77 void Swatch::setSpotColor(bool spotColor)
78 {
79  d->swatch.setSpotColor(spotColor);
80 }
81 
82 bool Swatch::isValid() const
83 {
84  return d->swatch.isValid();
85 }
86 
87 KisSwatch Swatch::kisSwatch() const
88 {
89  return d->swatch;
90 }
The Swatch class is a thin wrapper around the KisSwatch class.
Definition: Swatch.h:21
The ManagedColor class is a class to handle colors that are color managed.
Definition: ManagedColor.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 04:12:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.