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 QSGSIMPLETEXTURENODE_H |
5 | #define QSGSIMPLETEXTURENODE_H |
6 | |
7 | #include <QtQuick/qsgnode.h> |
8 | #include <QtQuick/qsggeometry.h> |
9 | #include <QtQuick/qsgtexturematerial.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QSGSimpleTextureNodePrivate; |
14 | |
15 | class Q_QUICK_EXPORT QSGSimpleTextureNode : public QSGGeometryNode |
16 | { |
17 | public: |
18 | QSGSimpleTextureNode(); |
19 | ~QSGSimpleTextureNode() override; |
20 | |
21 | void setRect(const QRectF &rect); |
22 | inline void setRect(qreal x, qreal y, qreal w, qreal h) { setRect(QRectF(x, y, w, h)); } |
23 | QRectF rect() const; |
24 | |
25 | void setSourceRect(const QRectF &r); |
26 | inline void setSourceRect(qreal x, qreal y, qreal w, qreal h) { setSourceRect(QRectF(x, y, w, h)); } |
27 | QRectF sourceRect() const; |
28 | |
29 | void setTexture(QSGTexture *texture); |
30 | QSGTexture *texture() const; |
31 | |
32 | void setFiltering(QSGTexture::Filtering filtering); |
33 | QSGTexture::Filtering filtering() const; |
34 | |
35 | enum TextureCoordinatesTransformFlag { |
36 | NoTransform = 0x00, |
37 | MirrorHorizontally = 0x01, |
38 | MirrorVertically = 0x02 |
39 | }; |
40 | Q_DECLARE_FLAGS(TextureCoordinatesTransformMode, TextureCoordinatesTransformFlag) |
41 | |
42 | void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode); |
43 | TextureCoordinatesTransformMode textureCoordinatesTransform() const; |
44 | |
45 | void setOwnsTexture(bool owns); |
46 | bool ownsTexture() const; |
47 | |
48 | private: |
49 | QSGGeometry m_geometry; |
50 | QSGOpaqueTextureMaterial m_opaque_material; |
51 | QSGTextureMaterial m_material; |
52 | |
53 | QRectF m_rect; |
54 | |
55 | Q_DECLARE_PRIVATE(QSGSimpleTextureNode) |
56 | }; |
57 | |
58 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGSimpleTextureNode::TextureCoordinatesTransformMode) |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QSGSIMPLETEXTURENODE_H |
63 | |