QRhiTextureCopyDescription Class

描述纹理到纹理的复制操作。更多

头文件: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
Qt 6.6

公共函数

QRhiTextureCopyDescription()
int destinationLayer() const
int destinationLevel() const
QPoint destinationTopLeft() const
QSize pixelSize() const
void setDestinationLayer(int layer)
void setDestinationLevel(int level)
void setDestinationTopLeft(const QPoint &p)
void setPixelSize(const QSize &sz)
void setSourceLayer(int layer)
void setSourceLevel(int level)
void setSourceTopLeft(const QPoint &p)
int sourceLayer() const
int sourceLevel() const
QPoint sourceTopLeft() const

详细说明

pixelSize() 表示要复制整个子资源。因此,默认构造的复制描述会导致复制第 0 层第 0 层的整个子资源。

注: 源纹理必须通过QRhiTexture::UsedAsTransferSource 创建。

注: pixelSize()、sourceTopLeft() 和destinationTopLeft() 定义的源矩形和目标矩形必须分别适合源纹理和目标纹理。否则将无法定义行为。

对于立方体贴图、三维纹理和纹理数组,一次只能复制一个面或片段。面或切片由源图层和目标图层索引指定。对于 mipmapped 纹理,一次只能复制一个 mip 层。源层和目标层以及 mip 层的索引可以不同,但必须仔细控制大小和位置,以避免出现越界复制的情况,在这种情况下,复制行为是未定义的。

注意: 这是一个 RHI API,兼容性保证有限,详情请查看QRhi

成员函数文档

[constexpr noexcept] QRhiTextureCopyDescription::QRhiTextureCopyDescription()

构建一个空的纹理副本描述。

int QRhiTextureCopyDescription::destinationLayer() const

返回目标阵列层(cubemap 面或阵列层索引)。默认为 0。

另请参见 setDestinationLayer()。

int QRhiTextureCopyDescription::destinationLevel() const

返回分拣 mip 级别。默认为 0。

另请参见 setDestinationLevel()。

QPoint QRhiTextureCopyDescription::destinationTopLeft() const

以像素为单位返回页面左上角的位置。默认值为 (0,0)。

另请参见 setDestinationTopLeft()。

QSize QRhiTextureCopyDescription::pixelSize() const

返回要复制区域的大小。

注意: 空的 pixelSize() 表示要复制整个子资源。因此,默认构建的复制描述会导致复制第 0 层第 0 层的整个子资源。

另请参阅 setPixelSize()。

void QRhiTextureCopyDescription::setDestinationLayer(int layer)

设置目标数组layer

另请参阅 destinationLayer() 。

void QRhiTextureCopyDescription::setDestinationLevel(int level)

设置目标 miplevel

另请参阅 destinationLevel() 。

void QRhiTextureCopyDescription::setDestinationTopLeft(const QPoint &p)

设置目标左上角位置p

另请参阅 destinationTopLeft() 。

void QRhiTextureCopyDescription::setPixelSize(const QSize &sz)

设置要复制到sz 的区域大小。

另请参阅 pixelSize() 。

void QRhiTextureCopyDescription::setSourceLayer(int layer)

设置源数组layer

另请参阅 sourceLayer() 。

void QRhiTextureCopyDescription::setSourceLevel(int level)

设置源 miplevel

另请参阅 sourceLevel() 。

void QRhiTextureCopyDescription::setSourceTopLeft(const QPoint &p)

将源的左上角位置设置为p

另请参见 sourceTopLeft().

int QRhiTextureCopyDescription::sourceLayer() const

返回源数组层(cubemap 面或数组层索引)。默认为 0。

另请参见 setSourceLayer()。

int QRhiTextureCopyDescription::sourceLevel() const

返回源 mip 级别。默认为 0。

另请参见 setSourceLevel()。

QPoint QRhiTextureCopyDescription::sourceTopLeft() const

返回源的左上角位置(以像素为单位)。默认为(0, 0)。

另请参见 setSourceTopLeft()。

© 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.