FastBlur QML Type
对一个或多个源项应用快速模糊效果。更多
Import Statement: | import Qt5Compat.GraphicalEffects |
Since: | QtGraphicalEffects 1.0 |
Inherits: |
属性
- cached : bool
- radius : real
- source : variant
- transparentBorder : bool
详细说明
FastBlur 效果通过使用源内容降频和双线性滤波算法对源内容进行模糊处理,从而柔化源内容。
来源 | 应用的效果 |
---|---|
示例
下面的示例展示了如何应用该效果。
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 |
此属性允许缓存效果输出像素,以提高渲染性能。
每次更改源或效果属性时,都必须更新缓存中的像素。由于需要额外的内存缓冲区来存储效果输出,因此会增加内存消耗。
建议在动画源或特效属性时禁用缓存。
默认情况下,该属性设置为false
。
radius : real |
该属性定义了影响单个像素模糊效果的相邻像素的距离。FastBlur 算法可能会在内部降低半径的精确度,以提供良好的渲染性能。
该值范围从 0.0(无模糊)到 inf。当半径超过值 64 时,模糊的视觉质量会降低。默认情况下,该属性设置为0.0
(无模糊)。
不同模糊值的输出示例 | ||
---|---|---|
半径: 0 | 半径32 | 半径:64 |
source : variant |
该属性定义了要模糊的源项。
注意: 不支持让效果包含自身,例如将源设置为效果的父项。
transparentBorder : bool |
该属性定义了项目边缘附近的模糊行为,像素模糊会受到源边缘以外像素的影响。
如果将该属性设置为true
,源以外的像素将被解释为透明,这与 OpenGL 夹角到边界扩展类似。模糊会稍微扩展到效果项区域之外。
如果将该属性设置为false
,源以外的像素将被解释为包含与项目边缘像素相同的颜色,这与 OpenGL 夹角到边缘行为类似。模糊不会扩展到效果项区域之外。
默认情况下,该属性设置为false
。
© 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.