组件内容模糊
为当前组件添加内容模糊效果。
说明:
从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
foregroundBlurStyle
foregroundBlurStyle(value: BlurStyle, options?: ForegroundBlurStyleOptions)
为当前组件提供内容模糊能力。
系统能力: SystemCapability.ArkUI.ArkUI.Full
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
value | BlurStyle | 是 | 内容模糊样式。模糊样式由模糊半径、蒙版颜色、蒙版透明度、饱和度、亮度五个参数组成。 |
options | ForegroundBlurStyleOptions | 否 | 可选参数,内容模糊选项。 |
ForegroundBlurStyleOptions对象说明
BlurStyleOptions
名称 | 参数类型 | 必填 | 描述 |
---|---|---|---|
colorMode | ThemeColorMode | 否 | 内容模糊效果使用的深浅色模式。 默认值:ThemeColorMode.System |
adaptiveColor | AdaptiveColor | 否 | 内容模糊效果使用的取色模式。 默认值:AdaptiveColor.Default |
blurOptions11+ | BlurOptions | 否 | 灰阶模糊参数。 |
示例
// xxx.ets
@Entry
@Component
struct ForegroundBlurStyleDemo {
build() {
Column() {
Text('Thin Material').fontSize(30).fontColor(0xCCCCCC)
Image($r('app.media.bg'))
.width(300)
.height(350)
.foregroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 })
}
.height('100%')
.width('100%')
}
}