Author: billy
Copyright statement: The copyright belongs to the author, please contact the author for commercial reprinting, please indicate the source for non-commercial reprinting
Attribute introduction
-
cached : bool
Output pixels using cache effects, which can improve rendering performance. Every time a source or effect property is changed, the pixels in the cache must be updated. Will increase memory consumption as additional memory buffers are required to store the effect output. So we recommend disabling caching when animating source properties or effect properties. Default is false -
range : variant
A change factor for how the value of each pixel's color channel changes according to the following equation:result.rgb = pow(original.rgb, 1.0 / gamma.rgb);
Setting a gamma value under QtVector3d(1.0, 1.0, 1.0) will darken the image, while a value on QtVector3d(1.0, 1.0, 1.0) will lighten the image. The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf (brightest). By default this property is set to QtVector3d(1.0, 1.0, 1.0) (no change) -
maximumInput : color
maximum input level per color channel. It sets the white point and all pixels with a value higher than this property are rendered as white (per color channel). Decreasing this value makes the lighted area brighter. The value ranges from "#ffffffff" to "#00000000". By default, this property is set to "#ffffffff" (no change) -
maximumOutput : color
Maximum output level per color channel. Decreasing this value will darken the lighted area, reducing contrast. The value ranges from "#ffffffff" to "#00000000". By default, this property is set to "#ffffffff" (no change) -
minimumInput : color
Minimum input level per color channel. It sets the black point and all pixels with a value lower than this property are rendered black (per color channel). Increasing this value will darken dark areas. The value ranges from "#ffffffff" to "#00000000". By default, this property is set to "#ffffffff" (no change) -
minimumOutput : color
Minimum output level per color channel. Increasing this value brightens dark areas, reducing contrast. The value ranges from "#ffffffff" to "#00000000". By default, this property is set to "#ffffffff" (no change) -
source : variant
The source item that provides the source pixel for the effect. Note: Allowing the effect to contain itself is not supported
Precautions
- LevelAdjust supports OpenGL rendering
- LevelAdjust adjusts the source item color for each color channel individually. Contrast of source items can be adjusted and color balance changed
Display of different numerical effects
Official example
import QtQuick 2.12
import QtGraphicalEffects 1.12
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"
}
}