Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qa8image_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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 QA8IMAGE_P_H
5#define QA8IMAGE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtGui/qimage.h>
20#include <QtCore/qshareddata.h>
21
23
24class Q_GUI_EXPORT QA8ImageData : public QSharedData
25{
26public:
27 QA8ImageData() : width(0), height(0), nbytes(0), data(nullptr) {}
28 QA8ImageData(const QA8ImageData &other);
29 ~QA8ImageData();
30
31 static QA8ImageData *create(QSize size);
32
33 int width;
34 int height;
35 int nbytes;
36 uchar *data;
37};
38
39// An 8-bit image with tightly packed scan lines (unlike QImage, which
40// aligns scan lines to 4 bytes).
41class Q_GUI_EXPORT QA8Image
42{
43public:
44 QA8Image();
45 QA8Image(int width, int height);
46 explicit QA8Image(QSize size);
47
48 bool isNull() const;
49
50 int width() const;
51 int height() const;
52 QSize size() const;
53 qsizetype sizeInBytes() const;
54
55 void fill(uchar value);
56
57 QA8Image copy(const QRect &rect = QRect()) const;
58 inline QA8Image copy(int x, int y, int w, int h) const
59 { return copy(QRect(x, y, w, h)); }
60
61 uchar *bits();
62 const uchar *bits() const;
63 const uchar *constBits() const;
64
65 uchar *scanLine(int);
66 const uchar *scanLine(int) const;
67 const uchar *constScanLine(int) const;
68
69 QImage toImage(QImage::Format format = QImage::Format_ARGB32_Premultiplied) const;
70
71private:
72 QA8Image(QA8ImageData *data);
73 QSharedDataPointer<QA8ImageData> d;
74};
75
76QT_END_NAMESPACE
77
78#endif // QA8IMAGE_P_H
Combined button and popup list for selecting options.