内容表

上一话题

QQuickTextDocument

下一话题

QQuickTransform

QQuickTextureFactory

QQuickTextureFactory class provides an interface for loading custom textures from QML. 更多

Inheritance diagram of PySide2.QtQuick.QQuickTextureFactory

概要

虚函数

静态函数

详细描述

The purpose of the texture factory is to provide a placeholder for a image data that can be converted into an OpenGL texture.

Creating a texture directly is not possible as there is rarely an OpenGL context available in the thread that is responsible for loading the image data.

class QQuickTextureFactory

Constructs a texture factory. Since QQuickTextureFactory is abstract, it cannot be instantiated directly.

PySide2.QtQuick.QQuickTextureFactory. createTexture ( window )
参数

window QQuickWindow

返回类型

QSGTexture

This function is called on the scene graph rendering thread to create a QSGTexture instance from the factory. window provides the context which this texture is created in.

QML will internally cache the returned texture as needed. Each call to this function should return a unique instance.

The OpenGL context used for rendering is bound when this function is called.

PySide2.QtQuick.QQuickTextureFactory. image ( )
返回类型

QImage

Returns an image version of this texture.

The lifespan of the returned image is unknown, so the implementation should return a self contained QImage , not make use of the QImage (uchar *, …) constructor.

This function is not commonly used and is expected to be slow.

PySide2.QtQuick.QQuickTextureFactory. textureByteCount ( )
返回类型

int

Returns the number of bytes of memory the texture consumes.

static PySide2.QtQuick.QQuickTextureFactory. textureFactoryForImage ( image )
参数

image QImage

返回类型

QQuickTextureFactory

返回 QQuickTextureFactory holding the given image .

This is typically used as a helper in textureFactory .

PySide2.QtQuick.QQuickTextureFactory. textureSize ( )
返回类型

QSize

Returns the size of the texture. This function will be called from arbitrary threads and should not rely on an OpenGL context bound.