FastBlur QML Type
对一个或多个源项目应用快速模糊效果。更多...
| Import Statement: | import Qt5Compat.GraphicalEffects |
| Since: | QtGraphicalEffects 1.0 |
| Inherits: |
属性
- cached : bool
- radius : real
- source : variant
- transparentBorder : bool
详细说明
注意: MultiEffect 组件 提供了一种 具有一定性能优势的模糊效果。对于新代码,应将其视为Qt XML中Graphical Effects 的替代方案。
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 | radius: 32 | radius: 64 |
source : variant
此属性定义了将被模糊的源项目。
注意: 不支持让效果包含自身,例如将“源”设置为该效果的父级。
transparentBorder : bool
该属性定义了项目边缘附近的模糊行为,此时像素的模糊效果会受到源区域边缘外部像素的影响。
如果将该属性设置为true ,则源区域外的像素将被解释为透明,这类似于 OpenGL 的“clamp-to-border”扩展。模糊效果会稍微扩展到效果项区域之外。
如果将该属性设置为false ,则源区域外的像素将被解释为与项目边缘像素具有相同的颜色,这类似于 OpenGL 的“clamp-to-edge”行为。模糊效果不会扩展到效果项目区域之外。
默认情况下,该属性设置为false 。
© 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.






