本页内容

QRgbaFloat Class

template <typename F> class QRgbaFloat

QRgbaFloat 结构体包含一个由四部分组成的 RGBA 浮点颜色值。更多内容...

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

公共类型

公共函数

quint8 alpha8() const
quint16 alpha16() const
float alpha() const
float alphaNormalized() const
quint8 blue8() const
quint16 blue16() const
float blue() const
float blueNormalized() const
quint8 green8() const
quint16 green16() const
float green() const
float greenNormalized() const
bool isOpaque() const
bool isTransparent() const
QRgbaFloat<T> premultiplied() const
quint8 red8() const
quint16 red16() const
float red() const
float redNormalized() const
void setAlpha(float alpha)
void setBlue(float blue)
void setGreen(float green)
void setRed(float red)
uint toArgb32() const
QRgbaFloat<T> unpremultiplied() const

静态公共成员

QRgbaFloat<T> fromArgb32(uint rgb)
QRgbaFloat<T> fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
QRgbaFloat<T> fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)

详细说明

QRgbaFloat 是一个模板类,其中F 指定了用于颜色分量的浮点类型。Qt 提供了两个类型别名:QRgbaFloat16 使用 16 位半精度浮点数,QRgbaFloat32 使用 32 位单精度浮点数。

另请参阅 QRgb 、QRgba64 和QColor 。

成员类型文档

[alias] QRgbaFloat::FastType

float 的别名。

成员函数文档

[constexpr] quint8 QRgbaFloat::alpha8() const

将Alpha通道作为8位值返回。

[constexpr] quint16 QRgbaFloat::alpha16() const

将Alpha通道作为16位整数返回。

[constexpr] float QRgbaFloat::alpha() const

返回阿尔法通道。

另请参阅 setAlpha()。

[constexpr] float QRgbaFloat::alphaNormalized() const

返回经过归一化、取值范围在0.0f 到1.0f 之间的Alpha通道。

另请参阅 alpha()。

[constexpr] quint8 QRgbaFloat::blue8() const

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

[constexpr] quint16 QRgbaFloat::blue16() const

返回蓝色色值,格式为 16 位整数。

[constexpr] float QRgbaFloat::blue() const

返回蓝色色分量。

另请参阅 setBlue()。

[constexpr] float QRgbaFloat::blueNormalized() const

返回归一化后的蓝色色度分量,其取值范围在0.0f 到1.0f 之间。

另请参阅 setBlue()。

[static constexpr] QRgbaFloat<T> QRgbaFloat::fromArgb32(uint rgb)

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

另请参阅 fromRgba() 和toArgb32()。

[static constexpr] QRgbaFloat<T> QRgbaFloat::fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)

根据四个 16 位整数颜色通道red 、green 、blue 和alpha 构建一个 `QRgbaFloat ` 值。

另请参阅 fromRgba()。

[static constexpr] QRgbaFloat<T> QRgbaFloat::fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)

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

另请参阅 fromArgb32()。

[constexpr] quint8 QRgbaFloat::green8() const

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

[constexpr] quint16 QRgbaFloat::green16() const

返回绿色色成分,格式为 16 位整数。

[constexpr] float QRgbaFloat::green() const

返回绿色色分量。

另请参阅 ` setGreen()`。

[constexpr] float QRgbaFloat::greenNormalized() const

返回绿色色成分,其值已归一化为0.0f 到1.0f 之间的范围。

另请参阅 setGreen()。

[constexpr] bool QRgbaFloat::isOpaque() const

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

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

[constexpr] bool QRgbaFloat::isTransparent() const

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

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

[constexpr] QRgbaFloat<T> QRgbaFloat::premultiplied() const

返回已预乘透明度的颜色。

另请参阅 unpremultiplied()。

[constexpr] quint8 QRgbaFloat::red8() const

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

[constexpr] quint16 QRgbaFloat::red16() const

返回红色色成分,格式为 16 位整数。

[constexpr] float QRgbaFloat::red() const

返回红色色分量。

另请参阅 setRed()。

[constexpr] float QRgbaFloat::redNormalized() const

返回归一化后的红色分量,其取值范围在0.0f 到1.0f 之间。

另请参阅 setRed()。

void QRgbaFloat::setAlpha(float alpha)

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

另请参阅 alpha()。

void QRgbaFloat::setBlue(float blue)

将该颜色的蓝色分量设置为blue 。

另请参阅 blue()。

void QRgbaFloat::setGreen(float green)

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

另请参阅 green()。

void QRgbaFloat::setRed(float red)

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

另请参阅 red()。

[constexpr] uint QRgbaFloat::toArgb32() const

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

另请参阅 fromArgb32()。

[constexpr] QRgbaFloat<T> QRgbaFloat::unpremultiplied() const

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

另请参阅 premultiplied()。

相关的非成员函数

QRgbaFloat16

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

QRgbaFloat32

一个 128 位的数据结构,包含四个 32 位的浮点颜色通道:红、绿、蓝和透明度。

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