DirectionalBlur QML Type
在指定方向上应用模糊效果。更多
Import Statement: | import Qt5Compat.GraphicalEffects |
Since: | QtGraphicalEffects 1.0 |
Inherits: |
属性
详细说明
该特效会让人感觉源项目似乎正沿着模糊的方向移动。模糊会应用到每个像素的两侧,因此将方向设置为 0 和 180 会产生相同的效果。
其他可用的运动模糊效果包括ZoomBlur 和RadialBlur 。
来源 | 应用的效果 |
---|---|
注: 此效果在使用 OpenGL 运行时可用。
示例
下面的示例展示了如何应用该效果。
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 } DirectionalBlur { anchors.fill: bug source: bug angle: 90 length: 32 samples: 24 } }
属性文档
angle : real |
cached : bool |
此属性允许缓存效果输出像素,以提高渲染性能。
每次更改源或效果属性时,都必须更新缓存中的像素。由于需要额外的内存缓冲区来存储效果输出,因此会增加内存消耗。
建议在动画源或特效属性时禁用缓存。
默认情况下,该属性设置为false
。
length : real |
samples : int |
该属性定义了计算模糊时每个像素取样的数量。数值越大,质量越好,但渲染速度越慢。
此属性不用于动画。更改此属性可能会导致重新编译底层 OpenGL 着色器。
允许值介于 0 和 inf 之间(实际最大值取决于 GPU)。默认情况下,该属性设置为0
(无采样)。
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.