1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCOLORMAP_H
5#define QCOLORMAP_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtGui/qrgb.h>
9#include <QtGui/qwindowdefs.h>
10#include <QtCore/qatomic.h>
11#include <QtCore/qlist.h>
12
13QT_BEGIN_NAMESPACE
14
15
16class QColor;
17class QColormapPrivate;
18
19class Q_WIDGETS_EXPORT QColormap
20{
21public:
22 enum Mode { Direct, Indexed, Gray };
23
24 static void initialize();
25 static void cleanup();
26
27 static QColormap instance(int screen = -1);
28
29 QColormap(const QColormap &colormap);
30 ~QColormap();
31
32 QColormap &operator=(const QColormap &colormap);
33
34 Mode mode() const;
35
36 int depth() const;
37 int size() const;
38
39 uint pixel(const QColor &color) const;
40 const QColor colorAt(uint pixel) const;
41
42 const QList<QColor> colormap() const;
43
44private:
45 QColormap();
46 QColormapPrivate *d;
47};
48
49QT_END_NAMESPACE
50
51#endif // QCOLORMAP_H
52

source code of qtbase/src/widgets/util/qcolormap.h