Applies a fast blur effect to one or more source items. 更多...
导入语句: | import Qt5Compat.GraphicalEffects |
Since: | QtGraphicalEffects 1.0 |
继承: | Item |
The FastBlur effect softens the source content by blurring it with algorithm which uses the source content downscaling and bilinear filtering.
源 | Effect applied |
---|---|
![]() |
![]() |
The following example shows how to apply the effect.
import QtQuick import Qt5Compat.GraphicalEffects Item { width: 300 height: 300 Image { id: bug source: "images/bug.jpg" sourceSize: Qt.size(parent.width, parent.height) smooth: true visible: false } FastBlur { anchors.fill: bug source: bug radius: 32 } }
cached : bool |
This property allows the effect output pixels to be cached in order to improve the rendering performance.
Every time the source or effect properties are changed, the pixels in the cache must be updated. Memory consumption is increased, because an extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect properties are animated.
By default, the property is set to
false
.
radius : real |
This property defines the distance of the neighboring pixels which affect the blurring of an individual pixel. A larger radius increases the blur effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to provide good rendering performance.
The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when radius exceeds value 64. By default, the property is set to
0.0
(no blur).
Output examples with different blur values | ||
---|---|---|
![]() |
![]() |
![]() |
radius: 0 | radius: 32 | radius: 64 |
source : variant |
This property defines the source item that is going to be blurred.
注意: It is not supported to let the effect include itself, for instance by setting source to the effect's parent.
transparentBorder : bool |
This property defines the blur behavior near the edges of the item, where the pixel blurring is affected by the pixels outside the source edges.
If the property is set to
true
, the pixels outside the source are interpreted to be transparent, which is similar to OpenGL clamp-to-border extension. The blur is expanded slightly outside the effect item area.
If the property is set to
false
, the pixels outside the source are interpreted to contain the same color as the pixels at the edge of the item, which is similar to OpenGL clamp-to-edge behavior. The blur does not expand outside the effect item area.
By default, the property is set to
false
.
Output examples with different transparentBorder values | ||
---|---|---|
![]() |
![]() |
|
transparentBorder: false | transparentBorder: true | |
radius : 64 | radius : 64 |