QSGSimpleTextureNode Class
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the QML scene graph. 更多...
头文件: | #include <QSGSimpleTextureNode> |
qmake: | QT += quick |
基类: | QSGGeometryNode |
This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
公有类型
enum | TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically } |
flags | TextureCoordinatesTransformMode |
公有函数
QSGSimpleTextureNode() | |
~QSGSimpleTextureNode() | |
QSGTexture::Filtering | filtering() const |
bool | ownsTexture() const |
QRectF | rect() const |
void | setFiltering(QSGTexture::Filtering filtering) |
void | setOwnsTexture(bool owns) |
void | setRect(const QRectF &r) |
void | setRect(qreal x, qreal y, qreal w, qreal h) |
void | setSourceRect(const QRectF &r) |
void | setSourceRect(qreal x, qreal y, qreal w, qreal h) |
void | setTexture(QSGTexture *texture) |
void | setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode) |
QRectF | sourceRect() const |
QSGTexture * | texture() const |
TextureCoordinatesTransformMode | textureCoordinatesTransform() const |
- 4 个公有函数继承自 QSGGeometryNode
- 3 个公有函数继承自 QSGBasicGeometryNode
- 20 个公有函数继承自 QSGNode
详细描述
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the QML scene graph.
Warning: The simple texture node class must have a texture before being added to the scene graph to be rendered.
Warning: This utility class is only functional when running with the OpenGL or software backends of the Qt Quick scenegraph. For a proper cross-platform alternative prefer using QSGImageNode via QQuickWindow::createImageNode() or QSGEngine::createImageNode().
成员类型
enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
flags QSGSimpleTextureNode::TextureCoordinatesTransformMode
The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.
Constant | Value | Description |
---|---|---|
QSGSimpleTextureNode::NoTransform | 0x00 | Texture coordinates are oriented with window coordinates i.e. with origin at top-left. |
QSGSimpleTextureNode::MirrorHorizontally | 0x01 | Texture coordinates are inverted in the horizontal axis with respect to window coordinates |
QSGSimpleTextureNode::MirrorVertically | 0x02 | Texture coordinates are inverted in the vertical axis with respect to window coordinates |
The TextureCoordinatesTransformMode type is a typedef for QFlags<TextureCoordinatesTransformFlag>. It stores an OR combination of TextureCoordinatesTransformFlag values.
成员函数
QSGSimpleTextureNode::QSGSimpleTextureNode()
Constructs a new simple texture node
QSGSimpleTextureNode::~QSGSimpleTextureNode()
Destroys the texture node
QSGTexture::Filtering QSGSimpleTextureNode::filtering() const
Returns the filtering currently set on this texture node
参见 setFiltering().
bool QSGSimpleTextureNode::ownsTexture() const
Returns true
if the node takes ownership of the texture; otherwise returns false
.
This function was introduced in Qt 5.4.
参见 setOwnsTexture().
QRectF QSGSimpleTextureNode::rect() const
Returns the target rect of this texture node.
参见 setRect().
void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering)
Sets the filtering to be used for this texture node to filtering.
For smooth scaling, use QSGTexture::Linear; for normal scaling, use QSGTexture::Nearest.
参见 filtering().
void QSGSimpleTextureNode::setOwnsTexture(bool owns)
Sets whether the node takes ownership of the texture to owns.
By default, the node does not take ownership of the texture.
This function was introduced in Qt 5.4.
参见 ownsTexture() and setTexture().
void QSGSimpleTextureNode::setRect(const QRectF &r)
Sets the target rect of this texture node to r.
参见 rect().
void QSGSimpleTextureNode::setRect(qreal x, qreal y, qreal w, qreal h)
This is an overloaded function.
Sets the rectangle of this texture node to begin at (x, y) and have width w and height h.
void QSGSimpleTextureNode::setSourceRect(const QRectF &r)
Sets the source rect of this texture node to r.
This function was introduced in Qt 5.5.
参见 sourceRect().
void QSGSimpleTextureNode::setSourceRect(qreal x, qreal y, qreal w, qreal h)
This is an overloaded function.
Sets the rectangle of this texture node to show its texture from (x, y) and have width w and height h relatively to the QSGTexture::textureSize.
This function was introduced in Qt 5.5.
void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
Sets the texture of this texture node to texture.
Use setOwnsTexture() to set whether the node should take ownership of the texture. By default, the node does not take ownership.
Warning: A texture node must have a texture before being added to the scenegraph to be rendered.
参见 texture().
void QSGSimpleTextureNode::setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)
Sets the method used to generate texture coordinates to mode. This can be used to obtain correct orientation of the texture. This is commonly needed when using a third party OpenGL library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.
参见 textureCoordinatesTransform().
QRectF QSGSimpleTextureNode::sourceRect() const
Returns the source rect of this texture node.
This function was introduced in Qt 5.5.
参见 setSourceRect().
QSGTexture *QSGSimpleTextureNode::texture() const
Returns the texture for this texture node
参见 setTexture().
TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const
Returns the mode used to generate texture coordinates for this node.