File indexing completed on 2024-12-22 04:11:42

0001 /*
0002  * This file is part of the KDE project
0003  * SPDX-FileCopyrightText: 2005 Boudewijn Rempt <boud@valdyas.org>
0004  * SPDX-FileCopyrightText: 2016 L. E. Segovia <amy@amyspark.me>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #ifndef KISSWATCH_H
0010 #define KISSWATCH_H
0011 
0012 #include "kritapigment_export.h"
0013 #include "KoColor.h"
0014 #include "KoColorModelStandardIds.h"
0015 #include <QString>
0016 
0017 class KRITAPIGMENT_EXPORT KisSwatch
0018 {
0019 public:
0020     KisSwatch() = default;
0021     KisSwatch(const KoColor &color, const QString &name = QString());
0022 
0023 public:
0024     QString name() const { return m_name; }
0025     void setName(const QString &name);
0026 
0027     QString id() const { return m_id; }
0028     void setId(const QString &id);
0029 
0030     KoColor color() const { return m_color; }
0031     void setColor(const KoColor &color);
0032 
0033     bool spotColor() const { return m_spotColor; }
0034     void setSpotColor(bool spotColor);
0035 
0036     bool isValid() const { return m_valid; }
0037 
0038     void writeToStream(QDataStream& stream, const QString& groupName, int originalRow , int originalColumn);
0039     static KisSwatch fromByteArray(QByteArray& data, QString &groupName, int &originalRow, int &originalColumn);
0040     static KisSwatch fromByteArray(QByteArray &data);
0041 
0042 public:
0043     bool operator==(const KisSwatch& rhs) const {
0044         return m_color == rhs.m_color && m_name == rhs.m_name;
0045     }
0046 
0047 private:
0048     KoColor m_color;
0049     QString m_name;
0050     QString m_id;
0051     bool m_spotColor {false};
0052     bool m_valid {false};
0053 };
0054 
0055 #endif // KISSWATCH_H