QRhiScissor Class
指定一个剪刀矩形。更多...
| 头文件: | #include <rhi/qrhi.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) 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 的QRhiGraphicsPipeline::UsesScissor 属性已设置时,才可设置剪切矩形。
QRhi 假设采用 OpenGL 风格的剪切坐标,即 x 和 y 以左下角为原点。不允许宽度或高度为负值。不过,除此之外,灵活的 OpenGL 语义依然适用:负的 x 和 y 值、部分超出边界的矩形等都将被妥善处理,并进行适当的裁剪。 因此,任何针对 OpenGL 的渲染逻辑都可以将剪切矩形原样传递给 QRhiScissor,无需任何调整。
注意:这是一个 兼容性保证有限的 RHI API,详情请参见QRhi 。
另请参阅 QRhiCommandBuffer::setScissor() 和QRhiViewport 。
成员函数文档
[constexpr noexcept default] QRhiScissor::QRhiScissor()
创建一个空的剪刀。
QRhiScissor::QRhiScissor(int x, int y, int w, int h)
根据由x 、y 、w 和h 指定的矩形构建一个剪刀。
注意: x 和y 默认表示左下角位置。w 或h 不能为负值,此类剪刀矩形将被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 对象a 和b 中的值相等,则返回false ;否则返回true 。
[noexcept] bool operator==(const QRhiScissor &a, const QRhiScissor &b)
如果两个QRhiScissor 对象a 和b 中的值相等,则返回true 。
© 2026 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.