QQuickTextureFactory Class
QQuickTextureFactory クラスは、QML からカスタムテクスチャを読み込むためのインターフェイスを提供します。詳細...
ヘッダー | #include <QQuickTextureFactory> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
qmake: | QT += quick |
継承: | QObject |
パブリック関数
QQuickTextureFactory() | |
virtual | ~QQuickTextureFactory() override |
virtual QSGTexture * | createTexture(QQuickWindow *window) const = 0 |
virtual QImage | image() const |
virtual int | textureByteCount() const = 0 |
virtual QSize | textureSize() const = 0 |
静的パブリックメンバ
QQuickTextureFactory * | textureFactoryForImage(const QImage &image) |
詳細な説明
テクスチャファクトリの目的は、OpenGLテクスチャに変換できる画像データのプレースホルダを提供することです。
テクスチャを直接作成することは、画像データのロードを担当するスレッドで利用可能なOpenGLコンテキストがほとんどないため、不可能です。
メンバー関数ドキュメント
QQuickTextureFactory::QQuickTextureFactory()
テクスチャ ファクトリを構築します。QQuickTextureFactory は抽象なので、直接インスタンス化することはできません。
[override virtual noexcept]
QQuickTextureFactory::~QQuickTextureFactory()
テクスチャ工場を破壊する。
[pure virtual]
QSGTexture *QQuickTextureFactory::createTexture(QQuickWindow *window) const
この関数はシーングラフのレンダリングスレッドで呼び出され、ファクトリーからQSGTexture インスタンスを作成します。window は、このテクスチャが作成されるコンテキストを提供します。
QMLは必要に応じて、返されたテクスチャを内部的にキャッシュします。この関数を呼び出すたびに、一意のインスタンスが返されます。
レンダリングに使用されるOpenGLコンテキストは、この関数が呼ばれたときにバインドされます。
[virtual]
QImage QQuickTextureFactory::image() const
このテクスチャの画像バージョンを返します。
返されるイメージの寿命は不明であるため、実装はQImage(uchar *, ...) コンストラクタを使用せず、自己のQImage を返すべきである。
この関数はあまり使用されず、動作が遅くなることが予想されます。
[pure virtual]
int QQuickTextureFactory::textureByteCount() const
テクスチャが消費するメモリのバイト数を返します。
[static]
QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage &image)
与えられたimage を保持するQQuickTextureFactory を返す。
これは通常、QQuickImageResponse::textureFactory のヘルパーとして使われる。
[pure virtual]
QSize QQuickTextureFactory::textureSize() const
テクスチャのサイズを返す。この関数は任意のスレッドから呼び出され、OpenGLのコンテキストバウンドに依存してはならない。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.