1// Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
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 QT3DEXTRAS_QTEXTUREATLAS_P_H
5#define QT3DEXTRAS_QTEXTUREATLAS_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 for the convenience
12// of other Qt classes. 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 <Qt3DExtras/qt3dextras_global.h>
19#include <Qt3DRender/qabstracttexture.h>
20#include <private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24namespace Qt3DExtras {
25
26class QTextureAtlasPrivate;
27
28class QTextureAtlas : public Qt3DRender::QAbstractTexture
29{
30 Q_OBJECT
31
32public:
33 typedef int TextureId;
34 static constexpr TextureId InvalidTexture = -1;
35
36 QTextureAtlas(Qt3DCore::QNode *parent = nullptr);
37 ~QTextureAtlas();
38
39 QOpenGLTexture::PixelFormat pixelFormat() const;
40 void setPixelFormat(QOpenGLTexture::PixelFormat fmt);
41
42 TextureId addImage(const QImage &image, int padding);
43 void removeImage(TextureId id);
44
45 qsizetype imageCount() const;
46
47 bool hasImage(TextureId id) const;
48 QRect imagePosition(TextureId id) const;
49 QRectF imageTexCoords(TextureId id) const;
50 int imagePadding(TextureId id) const;
51
52private:
53 Q_DECLARE_PRIVATE(QTextureAtlas)
54};
55
56} // namespace Qt3DExtras
57
58QT_END_NAMESPACE
59
60#endif // QT3DEXTRAS_QTEXTUREATLAS_P_H
61

source code of qt3d/src/extras/text/qtextureatlas_p.h