QQuickTextureFactory Class

QQuickTextureFactory 클래스는 QML에서 사용자 정의 텍스처를 로드하기 위한 인터페이스를 제공합니다. 더 보기...

Header: #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.