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)
15 : d(new Private)
16{
17 d->swatch = kisSwatch;
18}
19
20Swatch::Swatch()
21 : d(new Private)
22{
23
24}
25
26Swatch::~Swatch()
27{
28 delete d;
29}
30
31Swatch::Swatch(const Swatch &rhs)
32 : d(new Private)
33{
34 d->swatch = rhs.d->swatch;
35}
36
37Swatch &Swatch::operator=(const Swatch &rhs)
38{
39 if (&rhs == this) return *this;
40 d->swatch = rhs.d->swatch;
41 return *this;
42}
43
44QString Swatch::name() const
45{
46 return d->swatch.name();
47}
48
49void Swatch::setName(const QString &name)
50{
51 d->swatch.setName(name);
52}
53
54QString Swatch::id() const
55{
56 return d->swatch.id();
57}
58void Swatch::setId(const QString &id)
59{
60 d->swatch.setId(id);
61}
62
63ManagedColor *Swatch::color() const
64{
65 ManagedColor *c = new ManagedColor(d->swatch.color());
66 return c;
67}
68void Swatch::setColor(ManagedColor *color)
69{
70 d->swatch.setColor(color->color());
71}
72
73bool Swatch::spotColor() const
74{
75 return d->swatch.spotColor();
76}
77void Swatch::setSpotColor(bool spotColor)
78{
79 d->swatch.setSpotColor(spotColor);
80}
81
82bool Swatch::isValid() const
83{
84 return d->swatch.isValid();
85}
86
87KisSwatch Swatch::kisSwatch() const
88{
89 return d->swatch;
90}
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 Tue Mar 26 2024 11:20:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.