Krita Source Code Documentation
Loading...
Searching...
No Matches
Palette.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef LIBKIS_PALETTE_H
8#define LIBKIS_PALETTE_H
9
10#include <QObject>
11
12#include "kritalibkis_export.h"
13#include "libkis.h"
14#include "Resource.h"
15#include "KoColorSet.h"
16#include <Swatch.h>
17
18class ManagedColor;
19
20
43class KRITALIBKIS_EXPORT Palette : public QObject
44{
45 Q_OBJECT
46 Q_DISABLE_COPY(Palette)
47
48public:
49 explicit Palette(Resource *resource, QObject *parent = 0);
50 ~Palette() override;
51
52 bool operator==(const Palette &other) const;
53 bool operator!=(const Palette &other) const;
54
55public Q_SLOTS:
56
63 int numberOfEntries() const;
64
72 int columnCount();
80 void setColumnCount(int columns);
81
88 int rowCount();
89
95 int rowCountGroup(QString name);
96
102 void setRowCountGroup(int rows, QString name);
103
109 QString comment();
110
116 void setComment(QString comment);
117
123 QStringList groupNames() const;
124
131 void addGroup(QString name);
132
140 void removeGroup(QString name, bool keepColors = true);
141
148 int colorsCountTotal();
149
155 int colorsCountGroup(QString name);
156
163 int slotCount();
164
172 int slotCountGroup(QString name);
173
183 Q_DECL_DEPRECATED Swatch *colorSetEntryByIndex(int index);
184
191 Swatch *entryByIndex(int index);
192
202 Q_DECL_DEPRECATED Swatch *colorSetEntryFromGroup(int index, const QString &groupName);
203
211 Swatch *entryByIndexFromGroup(int index, const QString &groupName);
212
220 void addEntry(Swatch entry, QString groupName = QString());
221
227 void removeEntry(int index);
228
235 void removeEntryFromGroup(int index, const QString &groupName);
236
247 Q_DECL_DEPRECATED void changeGroupName(QString oldGroupName, QString newGroupName);
248
255 void renameGroup(QString oldGroupName, QString newGroupName);
256
263 void moveGroup(const QString &groupName, const QString &groupNameInsertBefore = QString());
264
272 bool save();
273
274private:
275 friend class PaletteView;
276 struct Private;
277 Private *const d;
278
283 KoColorSetSP colorSet();
284
285};
286
287#endif // LIBKIS_PALETTE_H
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
bool operator!=(const KoID &v1, const KoID &v2)
Definition KoID.h:103
The ManagedColor class is a class to handle colors that are color managed. A managed color is a color...
The PaletteView class is a wrapper around a MVC method for handling palettes. This class shows a nice...
Definition PaletteView.h:31
The Palette class Palette is a resource object that stores organised color data. It's purpose is to a...
Definition Palette.h:44
Private *const d
Definition Palette.h:277
The Swatch class is a thin wrapper around the KisSwatch class.
Definition Swatch.h:22