QSGImageNode Class

The QSGImageNode class is provided for convenience to easily draw textured content using the QML scene graph. 更多...

头文件: #include <QSGImageNode>
qmake: QT += quick
开始支持版本: Qt 5.8
基类: QSGGeometryNode

公有类型

enum TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically }
flags TextureCoordinatesTransformMode

公有函数

virtual ~QSGImageNode()
virtual QSGTexture::Filtering filtering() const = 0
virtual QSGTexture::Filtering mipmapFiltering() const = 0
virtual bool ownsTexture() const = 0
virtual QRectF rect() const = 0
virtual void setFiltering(QSGTexture::Filtering filtering) = 0
virtual void setMipmapFiltering(QSGTexture::Filtering filtering) = 0
virtual void setOwnsTexture(bool owns) = 0
virtual void setRect(const QRectF &rect) = 0
void setRect(qreal x, qreal y, qreal w, qreal h)
virtual void setSourceRect(const QRectF &rect) = 0
void setSourceRect(qreal x, qreal y, qreal w, qreal h)
virtual void setTexture(QSGTexture *texture) = 0
virtual void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode) = 0
virtual QRectF sourceRect() const = 0
virtual QSGTexture *texture() const = 0
virtual TextureCoordinatesTransformMode textureCoordinatesTransform() const = 0

静态公有成员

void rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, TextureCoordinatesTransformMode texCoordMode)

详细描述

The QSGImageNode class is provided for convenience to easily draw textured content using the QML scene graph.

Warning: The image node class must have a texture before being added to the scene graph to be rendered.

成员类型

enum QSGImageNode::TextureCoordinatesTransformFlag
flags QSGImageNode::TextureCoordinatesTransformMode

The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.

ConstantValueDescription
QSGImageNode::NoTransform0x00Texture coordinates are oriented with window coordinates i.e. with origin at top-left.
QSGImageNode::MirrorHorizontally0x01Texture coordinates are inverted in the horizontal axis with respect to window coordinates
QSGImageNode::MirrorVertically0x02Texture 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.

成员函数

[virtual] QSGImageNode::~QSGImageNode()

Destroys the instance of QSGImageNode. The destructor is virtual.

[pure virtual] QSGTexture::Filtering QSGImageNode::filtering() const

Returns the filtering for this image node.

参见 setFiltering().

[pure virtual] QSGTexture::Filtering QSGImageNode::mipmapFiltering() const

Returns the mipmap filtering for this image node.

参见 setMipmapFiltering().

[pure virtual] bool QSGImageNode::ownsTexture() const

Returns true if the node takes ownership of the texture; otherwise false.

参见 setOwnsTexture().

[static] void QSGImageNode::rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, TextureCoordinatesTransformMode texCoordMode)

[pure virtual] QRectF QSGImageNode::rect() const

Returns the target rect of this image node.

参见 setRect().

[pure virtual] void QSGImageNode::setFiltering(QSGTexture::Filtering filtering)

Sets the filtering to be used for this image node to filtering.

For smooth scaling, use QSGTexture::Linear. For normal scaling, use QSGTexture::Nearest.

参见 filtering().

[pure virtual] void QSGImageNode::setMipmapFiltering(QSGTexture::Filtering filtering)

Sets the mipmap filtering to be used for this image node to filtering.

For smooth scaling between mip maps, use QSGTexture::Linear. For normal scaling, use QSGTexture::Nearest.

参见 mipmapFiltering().

[pure virtual] void QSGImageNode::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.

参见 ownsTexture().

[pure virtual] void QSGImageNode::setRect(const QRectF &rect)

Sets the target rect of this image node to rect.

参见 rect().

void QSGImageNode::setRect(qreal x, qreal y, qreal w, qreal h)

This is an overloaded function.

Sets the rectangle of this image node to begin at (x, y) and have width w and height h.

[pure virtual] void QSGImageNode::setSourceRect(const QRectF &rect)

Sets the source rect of this image node to rect.

参见 sourceRect().

void QSGImageNode::setSourceRect(qreal x, qreal y, qreal w, qreal h)

This is an overloaded function.

Sets the rectangle of this image node to show its texture from (x, y) and have width w and height h relatively to the QSGTexture::textureSize.

[pure virtual] void QSGImageNode::setTexture(QSGTexture *texture)

Sets the texture of this image 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: An image node must have a texture before being added to the scenegraph to be rendered.

参见 texture().

[pure virtual] void QSGImageNode::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().

[pure virtual] QRectF QSGImageNode::sourceRect() const

Returns the source rect of this image node.

参见 setSourceRect().

[pure virtual] QSGTexture *QSGImageNode::texture() const

Returns the texture for this image node.

参见 setTexture().

[pure virtual] TextureCoordinatesTransformMode QSGImageNode::textureCoordinatesTransform() const

Returns the mode used to generate texture coordinates for this node.

参见 setTextureCoordinatesTransform().