本页内容

QRgba64 Class

QRgba64 结构体包含一个 64 位 RGB 颜色。更多内容...

头文件: #include <QRgba64>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

公共函数

QRgba64()
quint8 alpha8() const
quint16 alpha() const
quint8 blue8() const
quint16 blue() const
quint8 green8() const
quint16 green() const
bool isOpaque() const
bool isTransparent() const
QRgba64 premultiplied() const
quint8 red8() const
quint16 red() const
void setAlpha(quint16 alpha)
void setBlue(quint16 blue)
void setGreen(quint16 green)
void setRed(quint16 red)
uint toArgb32() const
ushort toRgb16() const
QRgba64 unpremultiplied() const
operator quint64() const
QRgba64 &operator=(quint64 rgba)

静态公共成员

QRgba64 fromArgb32(uint rgb)
QRgba64 fromRgba64(quint64 c)
QRgba64 fromRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
(since 6.11.1) size_t qHash(QRgba64 key, size_t seed = 0)

详细说明

QRgba64 是一个 64 位数据结构,包含四个 16 位颜色通道:红色、绿色、蓝色和透明度。

当需要更高精度时,QRgba64 可作为QRgb 的替代方案。特别是,预乘的 QRgba64 可以对未预乘的QRgb 进行操作,除 alpha 为 0 的情况外,不会造成精度损失。

另请参阅 QRgb 和QColor 。

成员函数文档

[constexpr noexcept default] QRgba64::QRgba64()

默认——构造一个QRgba64 的实例。

[constexpr] quint8 QRgba64::alpha8() const

将Alpha通道作为8位数据返回。

[constexpr] quint16 QRgba64::alpha() const

返回 16 位 Alpha 通道。

另请参阅 setAlpha()。

[constexpr] quint8 QRgba64::blue8() const

返回蓝色色分量,格式为 8 位。

[constexpr] quint16 QRgba64::blue() const

返回 16 位蓝色色成分。

另请参阅 ` setBlue()`。

[static constexpr] QRgba64 QRgba64::fromArgb32(uint rgb)

根据 32 位 ARGB 值rgb 构建一个QRgba64 值。

另请参阅 fromRgba()。

[static constexpr] QRgba64 QRgba64::fromRgba64(quint64 c)

返回c ,作为QRgba64 结构体。

另请参阅 fromArgb32()。

[static constexpr] QRgba64 QRgba64::fromRgba64(quint16 r, quint16 g, quint16 b, quint16 a)

返回QRgba64 四元组(r 、g 、b 、a )。

另请参阅 fromRgba()。

[static constexpr] QRgba64 QRgba64::fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)

根据四个 8 位颜色通道red 、green 、blue 和alpha 构建一个QRgba64 值。

另请参阅 fromArgb32()。

[constexpr] quint8 QRgba64::green8() const

返回绿色色成分,格式为 8 位。

[constexpr] quint16 QRgba64::green() const

返回 16 位绿色色成分。

另请参阅 setGreen()。

[constexpr] bool QRgba64::isOpaque() const

返回该颜色是否完全不透明。

另请参阅 isTransparent() 和alpha()。

[constexpr] bool QRgba64::isTransparent() const

返回该颜色是否为透明。

另请参阅 isOpaque() 和alpha()。

[constexpr] QRgba64 QRgba64::premultiplied() const

返回经过透明度预乘处理后的颜色。

另请参阅 unpremultiplied()。

[constexpr] quint8 QRgba64::red8() const

返回红色分量,格式为8位。

[constexpr] quint16 QRgba64::red() const

返回 16 位红色色成分。

另请参阅 setRed()。

void QRgba64::setAlpha(quint16 alpha)

将此颜色的透明度设置为alpha 。

另请参阅 alpha()。

void QRgba64::setBlue(quint16 blue)

将此颜色的蓝色色成分设置为blue 。

另请参阅 blue()。

void QRgba64::setGreen(quint16 green)

将此颜色的绿色色成分设置为green 。

另请参阅 green()。

void QRgba64::setRed(quint16 red)

将该颜色的红色分量设置为red 。

另请参阅 red()。

[constexpr] uint QRgba64::toArgb32() const

返回以 32 位 ARGB 值表示的颜色。

另请参阅 fromArgb32()。

[constexpr] ushort QRgba64::toRgb16() const

返回以 16 位 RGB 值表示的颜色。

另请参阅 toArgb32()。

[constexpr] QRgba64 QRgba64::unpremultiplied() const

返回未进行预乘的透明度颜色。

另请参阅 ` premultiplied()`。

[constexpr] QRgba64::operator quint64() const

将颜色作为 64 位无符号整数返回

[noexcept] QRgba64 &QRgba64::operator=(quint64 rgba)

将值rgba 赋给该 `QRgba64 ` 实例,并返回该实例。

相关的非成员

[constexpr noexcept, since 6.11.1] size_t qHash(QRgba64 key, size_t seed = 0)

返回key 的哈希值,并使用seed 作为计算的初始值。

在 Qt 6.11.1 之前的版本中,该类型可通过其对 quint64 的隐式转换实现哈希化。此显式的 qHash() 重载与该隐式 qHash() 保持兼容。

该函数在 Qt 6.11.1 中引入。

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