• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 组件内容模糊
2
3为当前组件添加内容模糊效果。
4
5>  **说明:**
6>
7>  从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
8
9## 属性
10| 名称 | 参数类型 | 描述 |
11| -------- | -------- | -------- |
12| foregroundBlurStyle | value:[BlurStyle](ts-appendix-enums.md#blurstyle9),<br/>options?:[ForegroundBlurStyleOptions](#foregroundblurstyleoptions10对象说明) | 为当前组件提供内容模糊能力。<br/>value: 内容模糊样式。模糊样式由模糊半径、蒙版颜色、蒙版透明度、饱和度、亮度五个参数组成。<br/>options: 可选参数,内容模糊选项。 |
13
14## ForegroundBlurStyleOptions对象说明
15
16| 名称                        | 参数类型                                                | 必填 | 描述                                                         |
17| --------------------------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
18| colorMode     | [ThemeColorMode](ts-appendix-enums.md#themecolormode10) | 否   | 内容模糊效果使用的深浅色模式。<br/>默认值:ThemeColorMode.System |
19| adaptiveColor | [AdaptiveColor](ts-appendix-enums.md#adaptivecolor10)   | 否   | 内容模糊效果使用的取色模式。<br/>默认值:AdaptiveColor.Default |
20| scale | number   | 否   | 内容模糊效果程度。此参数为系统接口。<br/>默认值:1.0 <br/>取值范围:[0.0, 1.0]<br/>|
21
22## 示例
23
24### 示例1
25
26```ts
27// xxx.ets
28@Entry
29@Component
30struct ForegroundBlurStyleDemo {
31  build() {
32    Column() {
33      Text('Thin Material').fontSize(30).fontColor(0xCCCCCC)
34      Image($r('app.media.bg'))
35        .width(300)
36        .height(350)
37        .foregroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 })
38    }
39    .height('100%')
40    .width('100%')
41  }
42}
43```
44
45![zh-cn_image_background_blur_style](figures/zh-cn_image_foreground_blur_style.png)