QRhiScissor 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

公共函数

QRhiScissor()
QRhiScissor(int x, int y, int w, int h)
std::array<int, 4> scissor() const
void setScissor(int x, int y, int w, int h)
size_t qHash(const QRhiScissor &key, size_t seed = 0)
bool operator!=(const QRhiScissor &a, const QRhiScissor &b)
bool operator==(const QRhiScissor &a, const QRhiScissor &b)

详细说明

QRhiCommandBuffer::setScissor() 一起使用。只有设置了QRhiGraphicsPipeline::UsesScissorQRhiGraphicsPipeline 才能设置剪刀矩形。

QRhi 假设使用 OpenGL 样式的剪刀坐标,即 x 和 y 均为左下角。宽度或高度不允许为负数。但除此之外,OpenGL 灵活的语义也适用:负的 x 和 y 值、部分出界的矩形等都会得到优雅的处理,并根据情况进行箝位。因此,任何以 OpenGL 为目标的渲染逻辑都可以将剪刀矩形原封不动地输入 QRhiScissor,而无需进行任何调整。

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

另请参见 QRhiCommandBuffer::setScissor() 和QRhiViewport

成员函数文档

[constexpr noexcept] QRhiScissor::QRhiScissor()

构造一个空剪刀。

QRhiScissor::QRhiScissor(int x, int y, int w, int h)

x,y,w, 和h 指定的矩形构建一个剪刀。

注: 假定xy 为左下角位置。不允许使用负数wh ,这样的剪刀矩形将被QRhiCommandBuffer 忽略。除此之外,灵活的 OpenGL 语义也适用:负的 x 和 y、部分出界的矩形等都将得到优雅的处理,并根据情况进行箝位。

std::array<int, 4> QRhiScissor::scissor() const

返回剪刀的位置和大小。

另请参见 setScissor()。

void QRhiScissor::setScissor(int x, int y, int w, int h)

将剪刀的位置和大小设置为x,y,w,h

注: 位置应在以左下角为原点的坐标系中指定,如 OpenGL。

另请参阅 scissor() 。

相关非会员

[noexcept] size_t qHash(const QRhiScissor &key, size_t seed = 0)

返回key 的哈希值,使用seed 作为计算的种子。

[noexcept] bool operator!=(const QRhiScissor &a, const QRhiScissor &b)

如果两个QRhiScissor 对象ab 中的值相等,则返回false ;否则返回true

[noexcept] bool operator==(const QRhiScissor &a, const QRhiScissor &b)

如果两个QRhiScissor 对象ab 中的值相等,则返回true

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