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
10struct Swatch::Private {
11 KisSwatch swatch;
12};
13
14Swatch::Swatch(const KisSwatch &kisSwatch, QObject *parent)
15 : QObject(parent)
16 , d(new Private)
17{
18 d->swatch = kisSwatch;
19}
20
21Swatch::Swatch(QObject *parent)
22 : QObject(parent)
23 , d(new Private)
24{
25
26}
27
28Swatch::~Swatch()
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
40Swatch &Swatch::operator=(const Swatch &rhs)
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{
64 d->swatch.setName(name);
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
76ManagedColor *Swatch::color() const
77{
78 ManagedColor *c = new ManagedColor(d->swatch.color());
79 return c;
80}
81void Swatch::setColor(ManagedColor *color)
82{
83 d->swatch.setColor(color->color());
84}
85
86bool Swatch::spotColor() const
87{
88 return d->swatch.spotColor();
89}
90void Swatch::setSpotColor(bool spotColor)
91{
92 d->swatch.setSpotColor(spotColor);
93}
94
95bool Swatch::isValid() const
96{
97 return d->swatch.isValid();
98}
99
100KisSwatch Swatch::kisSwatch() const
101{
102 return d->swatch;
103}
The ManagedColor class is a class to handle colors that are color managed.
The Swatch class is a thin wrapper around the KisSwatch class.
Definition Swatch.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.