Krita Source Code Documentation
Loading...
Searching...
No Matches
Swatch.cpp
Go to the documentation of this file.
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
13
14Swatch::Swatch(const KisSwatch &kisSwatch, QObject *parent)
15 : QObject(parent)
16 , d(new Private)
17{
19}
20
21Swatch::Swatch(QObject *parent)
22 : QObject(parent)
23 , d(new Private)
24{
25
26}
27
29{
30 delete d;
31}
32
33Swatch::Swatch(const Swatch &rhs, QObject *parent)
34 : QObject(parent)
35 , d(new Private)
36{
37 d->swatch = rhs.d->swatch;
38}
39
41{
42 if (&rhs == this) return *this;
43 d->swatch = rhs.d->swatch;
44 return *this;
45}
46
47bool Swatch::operator==(const Swatch &other) const
48{
49 return (d->swatch == other.d->swatch);
50}
51
52bool Swatch::operator!=(const Swatch &other) const
53{
54 return !(operator==(other));
55}
56
57QString Swatch::name() const
58{
59 return d->swatch.name();
60}
61
62void Swatch::setName(const QString &name)
63{
65}
66
67QString Swatch::id() const
68{
69 return d->swatch.id();
70}
71void Swatch::setId(const QString &id)
72{
73 d->swatch.setId(id);
74}
75
77{
79 return c;
80}
85
87{
88 return d->swatch.spotColor();
89}
90void Swatch::setSpotColor(bool spotColor)
91{
93}
94
95bool Swatch::isValid() const
96{
97 return d->swatch.isValid();
98}
99
101{
102 return d->swatch;
103}
void setSpotColor(bool spotColor)
Definition KisSwatch.cpp:38
KoColor color() const
Definition KisSwatch.h:30
QString name() const
Definition KisSwatch.h:24
void setColor(const KoColor &color)
Definition KisSwatch.cpp:32
bool spotColor() const
Definition KisSwatch.h:33
bool isValid() const
Definition KisSwatch.h:36
void setId(const QString &id)
Definition KisSwatch.cpp:26
void setName(const QString &name)
Definition KisSwatch.cpp:20
QString id() const
Definition KisSwatch.h:27
The ManagedColor class is a class to handle colors that are color managed. A managed color is a color...
KoColor color() const
The Swatch class is a thin wrapper around the KisSwatch class.
Definition Swatch.h:22
QString id() const
Definition Swatch.cpp:67
bool spotColor() const
Definition Swatch.cpp:86
Private *const d
Definition Swatch.h:58
void setName(const QString &name)
Definition Swatch.cpp:62
void setId(const QString &id)
Definition Swatch.cpp:71
QString name() const
Definition Swatch.cpp:57
virtual ~Swatch()
Definition Swatch.cpp:28
KisSwatch kisSwatch() const
Definition Swatch.cpp:100
Swatch(const KisSwatch &kisSwatch, QObject *parent=0)
Definition Swatch.cpp:14
bool operator==(const Swatch &other) const
Definition Swatch.cpp:47
ManagedColor * color() const
Definition Swatch.cpp:76
bool operator!=(const Swatch &other) const
Definition Swatch.cpp:52
Swatch & operator=(const Swatch &rhs)
Definition Swatch.cpp:40
void setColor(ManagedColor *color)
Definition Swatch.cpp:81
void setSpotColor(bool spotColor)
Definition Swatch.cpp:90
bool isValid() const
Definition Swatch.cpp:95
KisSwatch swatch
Definition Swatch.cpp:11