LevelAdjust QML Type
调整 RGBA 色彩空间中的颜色级别。更多...
| Import Statement: | import Qt5Compat.GraphicalEffects |
| Since: | QtGraphicalEffects 1.0 |
| Inherits: |
属性
- cached : bool
- gamma : variant
- maximumInput : color
- maximumOutput : color
- minimumInput : color
- minimumOutput : color
- source : variant
详细说明
此效果可针对源对象的每个颜色通道分别调整其颜色。可以调整源对象的对比度并改变其色彩平衡。
| 源 | 应用效果后 |
|---|---|
|
|
示例
以下示例演示了如何应用该效果。
import QtQuick
import Qt5Compat.GraphicalEffects
Item {
width: 300
height: 300
Image {
id: butterfly
source: "images/butterfly.png"
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}
LevelAdjust {
anchors.fill: butterfly
source: butterfly
minimumOutput: "#00ffffff"
maximumOutput: "#ff000000"
}
}属性文档
cached : bool
此属性允许将效果输出像素缓存起来,以提升渲染性能。
每次更改源或效果属性时,缓存中的像素都必须更新。由于需要额外的内存缓冲区来存储效果输出,因此内存消耗会增加。
当源或效果属性被动画化时,建议禁用缓存。
默认情况下,该属性设置为false 。
gamma : variant
该属性定义了每个像素颜色通道的值根据以下公式发生变化的调整因子:
result.rgb = pow(original.rgb, 1.0 / gamma.rgb);将伽马值设置为小于或等于 QtVector3d(1.0, 1.0, 1.0) 会使图像变暗,大于 QtVector3d(1.0, 1.0, 1.0) 则会使图像变亮。
该值的取值范围从 QtVector3d(0.0, 0.0, 0.0)(最暗)到 inf(最亮)。默认情况下,该属性设置为QtVector3d(1.0, 1.0, 1.0) (无变化)。
| 不同伽马值的输出示例 | ||
|---|---|---|
|
|
|
| gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 0.4, 2.0) | gamma: Qt.vector3d(1.0, 0.1, 4.0) |
| minimumInput: #000000 | minimumInput: #000000 | minimumInput: #000000 |
| maximumInput: #ffffff | maximumInput: #ffffff | maximumInput: #ffffff |
| minimumOutput: #000000 | minimumOutput: #000000 | minimumOutput: #000000 |
| maximumOutput: #ffffff | maximumOutput: #ffffff | maximumOutput: #ffffff |
| 上述图像的像素颜色通道亮度曲线。 | ||
|---|---|---|
|
|
|
| X轴:像素原始亮度 | ||
| Y轴:应用效果后的颜色通道亮度 |
maximumInput : color
此属性定义了每个颜色通道的最大输入电平。它设定了白点,所有值高于该属性的像素(按颜色通道计算)都会被渲染为白色。降低该值会使亮部区域变亮。
该值的取值范围为“#ffffffff”至“#00000000”。默认情况下,该属性设置为"#ffffffff" (保持不变)。
| 不同 maximumInput 值下的输出示例 | ||
|---|---|---|
|
|
|
| maximumInput: #FFFFFFFF | maximumInput: #FFFFFF80 | maximumInput: #FFFFFF30 |
| minimumInput: #000000 | minimumInput: #000000 | minimumInput: #000000 |
| minimumOutput: #000000 | minimumOutput: #000000 | minimumOutput: #000000 |
| maximumOutput: #ffffff | maximumOutput: #ffffff | maximumOutput: #ffffff |
| gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) |
| 上述图像的像素颜色通道亮度曲线。 | ||
|---|---|---|
|
|
|
| X 轴:像素原始亮度 | ||
| Y 轴:应用效果后的颜色通道亮度 |
maximumOutput : color
此属性定义了每个颜色通道的最大输出电平。减小该值会使亮部变暗,从而降低对比度。
该值的取值范围为“#ffffffff”至“#00000000”。默认情况下,该属性设置为"#ffffffff" (不作更改)。
| 不同 maximumOutput 值下的输出示例 | ||
|---|---|---|
|
|
|
| maximumOutput: #FFFFFFFF | maximumOutput: #FFFFFF80 | maximumOutput: #FFFFFF30 |
| minimumInput: #000000 | minimumInput: #000000 | minimumInput: #000000 |
| maximumInput: #ffffff | maximumInput: #ffffff | maximumInput: #ffffff |
| minimumOutput: #000000 | minimumOutput: #000000 | minimumOutput: #000000 |
| gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) |
| 上述图像的像素颜色通道亮度曲线。 | ||
|---|---|---|
|
|
|
| X 轴:像素原始亮度 | ||
| Y 轴:应用效果后的颜色通道亮度 |
minimumInput : color
此属性定义了每个颜色通道的最低输入电平。它用于设置黑点,所有值低于该属性的像素(按颜色通道计算)都会被渲染为黑色。增加该值会使暗部区域变暗。
该值的取值范围为“#00000000”至“#ffffffff”。默认情况下,该属性设置为"#00000000" (保持不变)。
| 不同 minimumInput 值下的输出示例 | ||
|---|---|---|
|
|
|
| minimumInput: #00000000 | minimumInput: #00000040 | minimumInput: #00000070 |
| maximumInput: #ffffff | maximumInput: #ffffff | maximumInput: #ffffff |
| minimumOutput: #000000 | minimumOutput: #000000 | minimumOutput: #000000 |
| maximumOutput: #ffffff | maximumOutput: #ffffff | maximumOutput: #ffffff |
| gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) |
| 上述图像的像素颜色通道亮度曲线。 | ||
|---|---|---|
|
|
|
| X 轴:像素原始亮度 | ||
| Y 轴:应用效果后的颜色通道亮度 |
minimumOutput : color
此属性定义了每个颜色通道的最小输出电平。增加该值会使暗部变亮,从而降低对比度。
该值的取值范围为“#00000000”至“#ffffffff”。默认情况下,该属性设置为"#00000000" (无变化)。
| 不同 minimumOutput 值下的输出示例 | ||
|---|---|---|
|
|
|
| minimumOutput: #00000000 | minimumOutput: #00000070 | minimumOutput: #000000A0 |
| minimumInput: #000000 | minimumInput: #000000 | minimumInput: #000000 |
| maximumInput: #ffffff | maximumInput: #ffffff | maximumInput: #ffffff |
| maximumOutput: #ffffff | maximumOutput: #ffffff | maximumOutput: #ffffff |
| gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) | gamma: Qt.vector3d(1.0, 1.0, 1.0) |
| 上述图像的像素颜色通道亮度曲线。 | ||
|---|---|---|
|
|
|
| X 轴:像素原始亮度 | ||
| Y轴:应用效果后的颜色通道亮度 |
source : variant
此属性定义了为该效果提供源像素的源项。
注意: 不支持让效果包含其自身,例如将“源”设置为该效果的父级。
© 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.



























