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

source code of qtdeclarative/src/quick/scenegraph/util/qsgimagenode.h