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

該類已過時。 提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

公共類型

enum TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically }
flags TextureCoordinatesTransformMode

公共函數

QSGSimpleTextureNode ()
virtual ~QSGSimpleTextureNode () override
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 (QSGSimpleTextureNode::TextureCoordinatesTransformMode mode )
QRectF sourceRect () const
QSGTexture * texture () const
QSGSimpleTextureNode::TextureCoordinatesTransformMode textureCoordinatesTransform () const

詳細描述

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

警告: The simple texture node class must have a texture before being added to the scene graph to be rendered.

警告: 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 憑藉 QQuickWindow::createImageNode () 或 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.

常量 描述
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

[override virtual] 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

返迴 true if the node takes ownership of the texture; otherwise returns false .

該函數在 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.

該函數在 Qt 5.4 引入。

另請參閱 ownsTexture () 和 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 )

這是重載函數。

Sets the rectangle of this texture node to begin at ( x , y ) and have width w 和高度 h .

void QSGSimpleTextureNode:: setSourceRect (const QRectF & r )

Sets the source rect of this texture node to r .

該函數在 Qt 5.5 引入。

另請參閱 sourceRect ().

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

這是重載函數。

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

該函數在 Qt 5.5 引入。

void QSGSimpleTextureNode:: setTexture ( QSGTexture * texture )

Sets the texture of this texture node to texture .

使用 setOwnsTexture () to set whether the node should take ownership of the texture. By default, the node does not take ownership.

警告: A texture node must have a texture before being added to the scenegraph to be rendered.

另請參閱 texture ().

void QSGSimpleTextureNode:: setTextureCoordinatesTransform ( QSGSimpleTextureNode::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.

該函數在 Qt 5.5 引入。

另請參閱 setSourceRect ().

QSGTexture *QSGSimpleTextureNode:: texture () const

Returns the texture for this texture node

另請參閱 setTexture ().

QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode:: textureCoordinatesTransform () const

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

另請參閱 setTextureCoordinatesTransform ().