Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSwatch.h
Go to the documentation of this file.
1/*
2 * This file is part of the KDE project
3 * SPDX-FileCopyrightText: 2005 Boudewijn Rempt <boud@valdyas.org>
4 * SPDX-FileCopyrightText: 2016 L. E. Segovia <amy@amyspark.me>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef KISSWATCH_H
10#define KISSWATCH_H
11
12#include "kritapigment_export.h"
13#include "KoColor.h"
15#include <QString>
16
17class KRITAPIGMENT_EXPORT KisSwatch
18{
19public:
20 KisSwatch() = default;
21 KisSwatch(const KoColor &color, const QString &name = QString());
22
23public:
24 QString name() const { return m_name; }
25 void setName(const QString &name);
26
27 QString id() const { return m_id; }
28 void setId(const QString &id);
29
30 KoColor color() const { return m_color; }
31 void setColor(const KoColor &color);
32
33 bool spotColor() const { return m_spotColor; }
34 void setSpotColor(bool spotColor);
35
36 bool isValid() const { return m_valid; }
37
38 void writeToStream(QDataStream& stream, const QString& groupName, int originalRow , int originalColumn);
39 static KisSwatch fromByteArray(QByteArray& data, QString &groupName, int &originalRow, int &originalColumn);
40 static KisSwatch fromByteArray(QByteArray &data);
41
42public:
43 bool operator==(const KisSwatch& rhs) const {
44 return m_color == rhs.m_color && m_name == rhs.m_name;
45 }
46
47private:
49 QString m_name;
50 QString m_id;
51 bool m_spotColor {false};
52 bool m_valid {false};
53};
54
55#endif // KISSWATCH_H
QString m_name
Definition KisSwatch.h:49
KoColor color() const
Definition KisSwatch.h:30
QString name() const
Definition KisSwatch.h:24
bool operator==(const KisSwatch &rhs) const
Definition KisSwatch.h:43
bool spotColor() const
Definition KisSwatch.h:33
bool isValid() const
Definition KisSwatch.h:36
QString m_id
Definition KisSwatch.h:50
KoColor m_color
Definition KisSwatch.h:48
QString id() const
Definition KisSwatch.h:27
KisSwatch()=default