QColorTransform Class

QColorTransform 类是色彩空间之间的转换。更多

Header: #include <QColorTransform>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

公共函数

(since 6.4) bool isIdentity() const
QRgb map(QRgb argb) const
QRgba64 map(QRgba64 rgba64) const
(since 6.4) QRgbaFloat16 map(QRgbaFloat16 rgbafp16) const
(since 6.4) QRgbaFloat32 map(QRgbaFloat32 rgbafp32) const
QColor map(const QColor &color) const
(since 6.4) bool operator!=(const QColorTransform &ct1, const QColorTransform &ct2)
(since 6.4) bool operator==(const QColorTransform &ct1, const QColorTransform &ct2)

详细描述

QColorTransform 是色彩空间之间转换的实例化。它可以应用于颜色和像素,将它们从一个颜色空间转换到另一个颜色空间。

要创建 QColorTransform,请使用QColorSpace::transformationToColorSpace() :

QColorSpace sourceColorSpace(QColorSpace::SRgb);
QColorSpace targetColorSpace(QColorSpace::DisplayP3);
QColorTransform srgbToP3Transform = sourceColorSpace.transformationToColorSpace(targetColorSpace);

设置 QColorTransform 需要一些预处理,因此建议保留一些经常需要的 QColorTransform,而不是即时生成。

成员函数文档

[noexcept, since 6.4] bool QColorTransform::isIdentity() const

如果颜色变换是标识变换,则返回 true。

此函数在 Qt 6.4 中引入。

QRgb QColorTransform::map(QRgb argb) const

QRgbargb 上应用颜色变换。

输入应为不透明或未倍增。

QRgba64 QColorTransform::map(QRgba64 rgba64) const

QRgba64rgba64 上应用颜色变换。

输入应为不透明或未倍增。

[since 6.4] QRgbaFloat16 QColorTransform::map(QRgbaFloat16 rgbafp16) const

QRgbaFloat16rgbafp16 上应用颜色变换。

输入应为不透明或未倍增。

此函数在 Qt 6.4 中引入。

[since 6.4] QRgbaFloat32 QColorTransform::map(QRgbaFloat32 rgbafp32) const

QRgbaFloat32rgbafp32 上应用颜色变换。

输入应为不透明或未倍增。

此函数在 Qt 6.4 中引入。

QColor QColorTransform::map(const QColor &color) const

QColor 值上应用颜色变换color

相关非会员

[since 6.4] bool operator!=(const QColorTransform &ct1, const QColorTransform &ct2)

如果ct1 未定义与ct2 相同的变换,则返回 true。

此函数在 Qt 6.4 中引入。

[since 6.4] bool operator==(const QColorTransform &ct1, const QColorTransform &ct2)

如果ct1ct2 定义了相同的颜色变换,则返回 true。

此函数在 Qt 6.4 中引入。

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