1e41f4b71Sopenharmony_ci# Image Effects 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciImage effects include blur, shadow, spherical effect, and much more. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## blur 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciblur(value: number, options?: BlurOptions) 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciApplies a foreground blur effect to the component. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Parameters** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 24e41f4b71Sopenharmony_ci| --------------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | 25e41f4b71Sopenharmony_ci| value | number | Yes | Foreground blur effect to apply to the component. The input parameter is the blur radius. The larger the radius is, the more blurred the content is. If the value is **0**, the content is not blurred.| 26e41f4b71Sopenharmony_ci| options<sup>11+</sup> | [BlurOptions](ts-appendix-enums.md#bluroptions11) | No | Grayscale parameters. | 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci## backdropBlur 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_cibackdropBlur(value: number, options?: BlurOptions) 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ciApplies a background blur effect to the component. 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci**Parameters** 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 43e41f4b71Sopenharmony_ci| --------------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | 44e41f4b71Sopenharmony_ci| value | number | Yes | Background blur effect to apply to the component. The input parameter is the blur radius. The larger the radius is, the more blurred the background is. If the value is **0**, the background is not blurred.| 45e41f4b71Sopenharmony_ci| options<sup>11+</sup> | [BlurOptions](ts-appendix-enums.md#bluroptions11) | No | Grayscale parameters. | 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci## shadow 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_cishadow(value: ShadowOptions | ShadowStyle) 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ciApplies a shadow effect to the component. 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci**Widget capability**: Since API version 9, this API is supported in ArkTS widgets. Yet, the [ShadowStyle](ts-universal-attributes-image-effect.md#shadowstyle10) type is not supported in ArkTS widgets. 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci**Parameters** 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 62e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 63e41f4b71Sopenharmony_ci| value | [ShadowOptions](#shadowoptions) \| [ShadowStyle](#shadowstyle10)<sup>10+</sup> | Yes | Shadow of the component.<br>When the value type is **ShadowOptions**, the blur radius, shadow color, and offset along the x-axis and y-axis can be specified.<br>When the value type is **ShadowStyle**, the shadow style can be specified.| 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci## grayscale 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_cigrayscale(value: number) 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ciApplies a grayscale effect to the component. 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci**Parameters** 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 80e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 81e41f4b71Sopenharmony_ci| value | number | Yes | Grayscale conversion ratio of the component. If the value is **1.0**, the component is completely converted to grayscale. If the value is **0.0**, the component remains unchanged. Between **0** and **1**, the value applies a linear multiplier on the grayscale effect. The unit is percentage.<br>Default value: **0.0**<br>Value range: [0.0, 1.0]<br>**NOTE**<br>A value less than **0.0** evaluates to the value **0.0**. A value greater than **1.0** evaluates to the value **1.0**.| 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci## brightness 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_cibrightness(value: number) 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ciApplies a brightness effect to the component. 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci**Parameters** 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 98e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 99e41f4b71Sopenharmony_ci| value | number | Yes | Brightness of the component. The value **1** indicates no effects. The value **0** indicates the complete darkness. If the value is less than 1, the brightness decreases. If the value is greater than 1, the brightness increases. A larger value indicates a higher brightness. However, if the value is greater than 2, the brightness does not change significantly with the value.<br>Default value: **1.0**<br>Recommended value range: [0, 2]<br>**NOTE**<br>A value less than 0 evaluates to the value **0**.<br>**Widget capability**: This API can be used in ArkTS widgets since API version 9.| 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci## saturate 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_cisaturate(value: number) 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ciApplies a saturation effect to the component. 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 108e41f4b71Sopenharmony_ci 109e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 112e41f4b71Sopenharmony_ci 113e41f4b71Sopenharmony_ci**Parameters** 114e41f4b71Sopenharmony_ci 115e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 116e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 117e41f4b71Sopenharmony_ci| value | number | Yes | Saturation of the component. The saturation is the ratio of the chromatic component to the achromatic component (gray) in a color. If the value is **1**, the original image is displayed. If the value is greater than **1**, a higher percentage of the chromatic component indicates a higher saturation. If the value is less than **1**, a higher percentage of the achromatic component indicates a lower saturation. The unit is percentage.<br>Default value: **1.0**<br>Recommended value range: [0, 50)<br>**NOTE**<br>A value less than 0 evaluates to the value **0**.| 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci## contrast 120e41f4b71Sopenharmony_ci 121e41f4b71Sopenharmony_cicontrast(value: number) 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ciApplies a contrast effect to the component. 124e41f4b71Sopenharmony_ci 125e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci**Parameters** 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 134e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 135e41f4b71Sopenharmony_ci| value | number | Yes | Contrast of the component. The input parameter is a contrast value. If the value is **1**, the source image is displayed. If the value is greater than 1, a larger value indicates a higher contrast and a clearer image. If the value is less than 1, a smaller value indicates a lower contrast is. If the value is **0**, the image becomes all gray. The unit is percentage.<br>Default value: **1.0**<br>Recommended value range: [0, 10)<br>**NOTE**<br>A value less than 0 evaluates to the value **0**.| 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci## invert 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ciinvert(value: number | InvertOptions) 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ciInverts the image. 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 146e41f4b71Sopenharmony_ci 147e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ci**Parameters** 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 152e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 153e41f4b71Sopenharmony_ci| value | number \| [InvertOptions](#invertoptions11)<sup>11+</sup> | Yes | How the image is inverted.<br>If the value is of the number type, it indicates the inversion ratio. If the value is **1**, the image is completely inverted. If the value is **0**, the image remains unchanged. The unit is percentage.<br>Value range: [0, 1]<br>A value less than 0 evaluates to the value **0**.<br>If the value is of the InvertOptions type, the grayscale value of the background color is compared with the threshold range. If the grayscale value is greater than the upper bound of the threshold range, the **high** value is used. If the grayscale value is less than the lower bound of the threshold range, the **low** value is used. If the grayscale value is within the threshold range, the background color changes linearly from high to low.| 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci## sepia 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_cisepia(value: number) 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ciSepia conversion ratio of the component. 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 164e41f4b71Sopenharmony_ci 165e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci**Parameters** 168e41f4b71Sopenharmony_ci 169e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 170e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 171e41f4b71Sopenharmony_ci| value | number | Yes | Sepia conversion ratio of the component. If the value is **1**, the image is completely sepia. If the value is **0**, the component remains unchanged. The unit is percentage.| 172e41f4b71Sopenharmony_ci 173e41f4b71Sopenharmony_ci## hueRotate 174e41f4b71Sopenharmony_ci 175e41f4b71Sopenharmony_cihueRotate(value: number | string) 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ciRotates the hue of the component. 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ci**Parameters** 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 188e41f4b71Sopenharmony_ci| ------ | -------------------------- | ---- | ------------------------------------------------------------ | 189e41f4b71Sopenharmony_ci| value | number \| string | Yes | Hue rotation angle of the component.<br>Default value: **'0deg'**<br>Value range: (-∞, +∞)<br>**NOTE**<br>A rotation of 360 degrees leaves the color unchanged. A rotation of 180 degrees and then -180 degrees also leaves the color unchanged. When the data type is number, the value **90** is equivalent to **'90deg'**.| 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci## colorBlend<sup>7+</sup> 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_cicolorBlend(value: Color | string | Resource) 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ciApplies a color blend effect to the component. 196e41f4b71Sopenharmony_ci 197e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 200e41f4b71Sopenharmony_ci 201e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 202e41f4b71Sopenharmony_ci 203e41f4b71Sopenharmony_ci**Parameters** 204e41f4b71Sopenharmony_ci 205e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 206e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ---------------------------------------------- | 207e41f4b71Sopenharmony_ci| value | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | Yes | Color to blend with the component.| 208e41f4b71Sopenharmony_ci 209e41f4b71Sopenharmony_ci## linearGradientBlur<sup>12+</sup> 210e41f4b71Sopenharmony_ci 211e41f4b71Sopenharmony_cilinearGradientBlur(value: number, options: LinearGradientBlurOptions) 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ciApplies a linear gradient foreground blur effect to the component. 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ci**Parameters** 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 220e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 221e41f4b71Sopenharmony_ci| value | number | Yes | Blur radius. A larger value indicates a higher blur degree. If the value is 0, the content is not blurred.<br>Value range: [0, 60]<br>Linear gradient blur consists of two parts: **fractionStops** and **direction**.| 222e41f4b71Sopenharmony_ci| options | [LinearGradientBlurOptions](#lineargradientbluroptions12) | Yes | Linear gradient blur effect. | 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ci## renderGroup<sup>10+</sup> 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_cirenderGroup(value: boolean) 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ciSets whether the component and its child components are rendered off the screen and then drawn together with its parent. 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**Parameters** 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 237e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ | 238e41f4b71Sopenharmony_ci| value | boolean | Yes | Whether the component and its child components are rendered off the screen and then drawn together with its parent. If the opacity of the component is not 1, the drawing effect may vary depending on the value.<br>Default value: **false**| 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci## blendMode<sup>11+</sup> 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ciblendMode(value: BlendMode, type?: BlendApplyType) 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ciDefines how the component's content (including the content of it child components) is blended with the existing content on the canvas (possibly offscreen canvas) below. 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 11. 247e41f4b71Sopenharmony_ci 248e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci**Parameters** 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 253e41f4b71Sopenharmony_ci| ------ | ------------------------------- | ---- | ------------------------------------------------------------ | 254e41f4b71Sopenharmony_ci| value | [BlendMode](#blendmode11) | Yes | Blend mode.<br>Default value: **BlendMode.NONE** | 255e41f4b71Sopenharmony_ci| type | [BlendApplyType](ts-appendix-enums.md#blendapplytype11) | No | Whether the blend mode is implemented offscreen.<br>Default value: **BlendApplyType.FAST**<br>**NOTE**<br>1. Available options:<br>**BlendApplyType.FAST**: The blend mode is not implemented offscreen.<br>2. **BlendApplyType.OFFSCREEN**: The component's content (including the content of it child components) is drawn on the offscreen canvas, and then blended with the existing content on the canvas in the specified blend mode. | 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci## useShadowBatching<sup>11+</sup> 258e41f4b71Sopenharmony_ci 259e41f4b71Sopenharmony_ciuseShadowBatching(value: boolean) 260e41f4b71Sopenharmony_ci 261e41f4b71Sopenharmony_ciSets whether to draw shadows of child nodes in the component at the same layer, so that the shadows of elements at the same layer overlap. 262e41f4b71Sopenharmony_ci 263e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 264e41f4b71Sopenharmony_ci 265e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 266e41f4b71Sopenharmony_ci 267e41f4b71Sopenharmony_ci**Parameters** 268e41f4b71Sopenharmony_ci 269e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 270e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ | 271e41f4b71Sopenharmony_ci| value | boolean | Yes | Whether to draw shadows of child nodes in the component at the same layer, so that the shadows of elements at the same layer overlap.<br>Default value: **false**<br>**NOTE**<br>1. When this feature is disabled (default), if the shadow radius of a child node is large, the shadows of the child nodes may overlap. This overlap issue does not occur when the feature is enabled.<br>2. Avoid nesting **useShadowBatching**. When used in nested mode, **useShadowBatching** takes effect for the current child node only and cannot be recursively used.| 272e41f4b71Sopenharmony_ci 273e41f4b71Sopenharmony_ci## sphericalEffect<sup>12+</sup> 274e41f4b71Sopenharmony_ci 275e41f4b71Sopenharmony_cisphericalEffect(value: number) 276e41f4b71Sopenharmony_ci 277e41f4b71Sopenharmony_ciApplies a spherical effect to the component. 278e41f4b71Sopenharmony_ci 279e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_ci**Parameters** 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 284e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 285e41f4b71Sopenharmony_ci| value | number | Yes | Spherical degree of the component.<br>The value ranges from 0 to 1.<br>**NOTE**<br>1. If the value is **0**, the component remains unchanged. If the value is 1, the component is completely spherical. Between **0** and **1**, a larger value indicates a higher spherical degree.<br>A value less than 0 is handled as the value **0**. A value greater than 1 is handled as the value **1**.<br>2. If a component image is loaded asynchronously, the spherical effect is not supported. For example, the **\<Image>** component uses asynchronous loading by default, which means that **syncLoad** must be set to **true** to apply the spherical effect. However, this setting is not recommended. Asynchronous loading is also used for **backgroundImage**. Therefore, if **backgroundImage** is set, the spherical effect is not supported.<br>3. If the shadow effect is set for a component, the spherical effect is not supported.<br>4. If the value is greater than 0, the component is frozen and not updated, and its content is drawn to the transparent offscreen buffer. To update the component attributes, set the value to **0**.| 286e41f4b71Sopenharmony_ci 287e41f4b71Sopenharmony_ci## lightUpEffect<sup>12+</sup> 288e41f4b71Sopenharmony_ci 289e41f4b71Sopenharmony_cilightUpEffect(value: number) 290e41f4b71Sopenharmony_ci 291e41f4b71Sopenharmony_ciApplies a light up effect to the component. 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci**Parameters** 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 298e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 299e41f4b71Sopenharmony_ci| value | number | Yes | Light up degree of the component.<br>The value ranges from 0 to 1.<br>If the value is **0**, the component is dark. If the value is **1**, the component is fully illuminated. Between **0** and **1**, a larger value indicates higher luminance. A value less than 0 is handled as the value **0**. A value greater than 1 is handled as the value **1**.| 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci## pixelStretchEffect<sup>12+</sup> 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_cipixelStretchEffect(options: PixelStretchEffectOptions) 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_ciApplies a pixel stretch effect to the component. 306e41f4b71Sopenharmony_ci 307e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 308e41f4b71Sopenharmony_ci 309e41f4b71Sopenharmony_ci**Parameters** 310e41f4b71Sopenharmony_ci 311e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 312e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 313e41f4b71Sopenharmony_ci| options | [PixelStretchEffectOptions](ts-types.md#pixelstretcheffectoptions10) | Yes | Pixel stretch effect options.<br>The value includes the length by which a pixel is stretched toward the four edges.<br>**NOTE**<br>1. If the length is a positive value, the original image is stretched, and the image size increases. The edge pixels grow by the set length toward the top, bottom, left, and right edges.<br>2. If the length is a negative value, the original image shrinks as follows, but the image size remains unchanged:<br>Shrinking mode:<br>(1) The image shrinks from the four edges by the absolute value of length set through **options**.<br>(2) The image is stretched back to the original size with edge pixels.<br>3. Constraints on **options**:<br>(1) The length values for the four edges must be all positive or all negative. That is, the four edges are stretched or shrink at the same time in the same direction.<br>(2) The length values must all be a percentage or a specific value. Combined use of the percentage and specific value is not allowed.<br>(3) If the input value is invalid, the image is displayed as {0, 0, 0, 0}, that is, the image is the same as the original image.| 314e41f4b71Sopenharmony_ci 315e41f4b71Sopenharmony_ci## systemBarEffect<sup>12+</sup> 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_cisystemBarEffect() 318e41f4b71Sopenharmony_ci 319e41f4b71Sopenharmony_ciApplies a system bar effect to the component, which means to invert colors based on the background and add a blur. 320e41f4b71Sopenharmony_ci 321e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 322e41f4b71Sopenharmony_ci 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ci## ShadowOptions 325e41f4b71Sopenharmony_ci 326e41f4b71Sopenharmony_ciProvides the shadow attributes, including the blur radius, color, and offset along the x-axis and y-axis. 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci 329e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 330e41f4b71Sopenharmony_ci 331e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 332e41f4b71Sopenharmony_ci 333e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 334e41f4b71Sopenharmony_ci| ------- | ---------------------------------------- | ---- | ---------------------------------------- | 335e41f4b71Sopenharmony_ci| radius | number \| [Resource](ts-types.md#resource) | Yes | Blur radius of the shadow.<br>Value range: [0, +∞)<br>Unit: px<br>**NOTE**<br>A value less than 0 evaluates to the value **0**.<br>To use a value in the vp unit, call [vp2px](ts-pixel-units.md#pixel-unit-conversion) to convert it into px.<br>If **radius** is of the Resource type, its value must be of the number type.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 336e41f4b71Sopenharmony_ci| type<sup>10+</sup> | [ShadowType<sup>10+</sup>](ts-appendix-enums.md#shadowtype10) | No | Shadow type.<br>Default value: **COLOR**<br>**Atomic service API**: This API can be used in atomic services since API version 11. | 337e41f4b71Sopenharmony_ci| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource)\| [ColoringStrategy<sup>10+</sup> ](ts-types.md#coloringstrategy10) | No | Color of the shadow.<br>The default color is black.<br>**NOTE**<br>Since API version 11, this API supports **ColoringStrategy**, which cannot be used with ArkTS widgets or the [textShadow](ts-basic-components-text.md#attributes) attribute.<br>With **ColoringStrategy**, the average color or primary color can be obtained, and the obtained color is applied to the shadow drawing area.<br>The **'average'** string can be used to trigger the mode for obtaining the average color, and the **'primary'** string for obtaining the primary color.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 338e41f4b71Sopenharmony_ci| offsetX | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the x-axis.<br>Default value: **0**<br>Unit: px<br>**NOTE**<br>To use a value in the vp unit, call [vp2px](ts-pixel-units.md#pixel-unit-conversion) to convert it into px.<br>If **offsetX** is of the Resource type, its value must be of the number type.<br> **Atomic service API**: This API can be used in atomic services since API version 11.| 339e41f4b71Sopenharmony_ci| offsetY | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the y-axis.<br>Default value: **0**<br>Unit: px<br>**NOTE**<br>To use a value in the vp unit, call [vp2px](ts-pixel-units.md#pixel-unit-conversion) to convert it into px.<br>If **offsetY** is of the Resource type, its value must be of the number type.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 340e41f4b71Sopenharmony_ci| fill<sup>11+</sup> | boolean | No | Whether to fill the inside of the component with shadow.<br>The default value is **false**.<br>**NOTE**<br>This attribute does not take effect in [textShadow](ts-basic-components-text.md#attributes).<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_ci## ShadowStyle<sup>10+</sup> 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci| Name | Description | 347e41f4b71Sopenharmony_ci| ----------------- | ------ | 348e41f4b71Sopenharmony_ci| OUTER_DEFAULT_XS | Mini shadow. | 349e41f4b71Sopenharmony_ci| OUTER_DEFAULT_SM | Small shadow. | 350e41f4b71Sopenharmony_ci| OUTER_DEFAULT_MD | Medium shadow. | 351e41f4b71Sopenharmony_ci| OUTER_DEFAULT_LG | Large shadow. | 352e41f4b71Sopenharmony_ci| OUTER_FLOATING_SM | Floating small shadow.| 353e41f4b71Sopenharmony_ci| OUTER_FLOATING_MD | Floating medium shadow.| 354e41f4b71Sopenharmony_ci 355e41f4b71Sopenharmony_ci## BlendMode<sup>11+</sup> 356e41f4b71Sopenharmony_ci 357e41f4b71Sopenharmony_ci> **NOTE** 358e41f4b71Sopenharmony_ci> 359e41f4b71Sopenharmony_ci> In the **blendMode** enums, **s** indicates the source pixel, **d** indicates the target pixel, **sa** indicates the opacity of the source pixel, **da** indicates the opacity of the target pixel, **r** indicates the pixel after blending, and **ra** indicates the opacity of the pixel after blending. 360e41f4b71Sopenharmony_ci 361e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 11. 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ci| Name | Description | 364e41f4b71Sopenharmony_ci| ---------------| ------ | 365e41f4b71Sopenharmony_ci| NONE | The top image is superimposed on the bottom image without any blending. | 366e41f4b71Sopenharmony_ci| CLEAR | The target pixels covered by the source pixels are erased by being turned to completely transparent. | 367e41f4b71Sopenharmony_ci| SRC | r = s: Only the source pixels are displayed. | 368e41f4b71Sopenharmony_ci| DST | r = d: Only the target pixels are displayed. | 369e41f4b71Sopenharmony_ci| SRC_OVER | r = s + (1 - sa) * d: The source pixels are blended based on opacity and cover the target pixels. | 370e41f4b71Sopenharmony_ci| DST_OVER | r = d + (1 - da) * s: The target pixels are blended based on opacity and cover on the source pixels. | 371e41f4b71Sopenharmony_ci| SRC_IN | r = s * da: Only the part of the source pixels that overlap with the target pixels is displayed. | 372e41f4b71Sopenharmony_ci| DST_IN | r = d * sa: Only the part of the target pixels that overlap with the source pixels is displayed. | 373e41f4b71Sopenharmony_ci| SRC_OUT | r = s * (1 - da): Only the part of the source pixels that do not overlap with the target pixels is displayed. | 374e41f4b71Sopenharmony_ci| DST_OUT | r = d * (1 - sa): Only the part of the target pixels that do not overlap with the source pixels is displayed. | 375e41f4b71Sopenharmony_ci| SRC_ATOP | r = s * da + d * (1 - sa): The part of the source pixels that overlap with the target pixels is displayed and the part of the target pixels that do not overlap with the source pixels are displayed. | 376e41f4b71Sopenharmony_ci| DST_ATOP | r = d * sa + s * (1 - da): The part of the target pixels that overlap with the source pixels and the part of the source pixels that do not overlap with the target pixels are displayed. | 377e41f4b71Sopenharmony_ci| XOR | r = s * (1 - da) + d * (1 - sa): Only the non-overlapping part between the source pixels and the target pixels is displayed. | 378e41f4b71Sopenharmony_ci| PLUS | r = min(s + d, 1): New pixels resulting from adding the source pixels to the target pixels are displayed. | 379e41f4b71Sopenharmony_ci| MODULATE | r = s * d: New pixels resulting from multiplying the source pixels with the target pixels are displayed. | 380e41f4b71Sopenharmony_ci| SCREEN | r = s + d - s * d: Pixels are blended by adding the source pixels to the target pixels and subtracting the product of their multiplication. | 381e41f4b71Sopenharmony_ci| OVERLAY | The MULTIPLY or SCREEN mode is used based on the target pixels. | 382e41f4b71Sopenharmony_ci| DARKEN | rc = s + d - max(s * da, d * sa), ra = kSrcOver: When two colors overlap, whichever is darker is used. | 383e41f4b71Sopenharmony_ci| LIGHTEN | rc = s + d - min(s * da, d * sa), ra = kSrcOver: The darker of the pixels (source and target) is used. | 384e41f4b71Sopenharmony_ci| COLOR_DODGE | The colors of the target pixels are lightened to reflect the source pixels. | 385e41f4b71Sopenharmony_ci| COLOR_BURN | The colors of the target pixels are darkened to reflect the source pixels. | 386e41f4b71Sopenharmony_ci| HARD_LIGHT | The MULTIPLY or SCREEN mode is used, depending on the source pixels. | 387e41f4b71Sopenharmony_ci| SOFT_LIGHT | The LIGHTEN or DARKEN mode is used, depending on the source pixels. | 388e41f4b71Sopenharmony_ci| DIFFERENCE | rc = s + d - 2 * (min(s * da, d * sa)), ra = kSrcOver: The final pixel is the result of subtracting the darker of the two pixels (source and target) from the lighter one. | 389e41f4b71Sopenharmony_ci| EXCLUSION | rc = s + d - two(s * d), ra = kSrcOver: The final pixel is similar to <b>DIFFERENCE</b>, but with less contrast. | 390e41f4b71Sopenharmony_ci| MULTIPLY | r = s * (1 - da) + d * (1 - sa) + s * d: The final pixel is the result of multiplying the source pixel by the target pixel. | 391e41f4b71Sopenharmony_ci| HUE | The resultant image is created with the luminance and saturation of the source image and the hue of the target image. | 392e41f4b71Sopenharmony_ci| SATURATION | The resultant image is created with the luminance and hue of the target image and the saturation of the source image. | 393e41f4b71Sopenharmony_ci| COLOR | The resultant image is created with the saturation and hue of the source image and the luminance of the target image. | 394e41f4b71Sopenharmony_ci| LUMINOSITY | The resultant image is created with the saturation and hue of the target image and the luminance of the source image. | 395e41f4b71Sopenharmony_ci 396e41f4b71Sopenharmony_ci## LinearGradientBlurOptions<sup>12+</sup> 397e41f4b71Sopenharmony_ci 398e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 399e41f4b71Sopenharmony_ci| ------------- | ----------------------------------------------------------- | ----- | ------------------------------------------------------------ | 400e41f4b71Sopenharmony_ci| fractionStops | Array\<[FractionStop](#fractionstop12)> | Yes | Gradient blur stops. The value is a set of binary arrays, each of which indicates [blur degree, blur position] and consists of numbers ranging from 0 to 1 (those less than 0 evaluate to **0**, and those greater than 1 evaluate to **1**). The blur positions in the arrays must be in strict ascending order. Noncompliance will be logged. For the blur settings to take effect, the number of binary arrays must be greater than or equal to 2.| 401e41f4b71Sopenharmony_ci| direction | [GradientDirection](ts-appendix-enums.md#gradientdirection) | Yes | Gradient blur direction.<br>Default value:<br>GradientDirection.Bottom | 402e41f4b71Sopenharmony_ci 403e41f4b71Sopenharmony_ci## FractionStop<sup>12+</sup> 404e41f4b71Sopenharmony_ci 405e41f4b71Sopenharmony_ciFractionStop = [ number, number ] 406e41f4b71Sopenharmony_ci 407e41f4b71Sopenharmony_ciDefines a gradient blur stop. 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 410e41f4b71Sopenharmony_ci 411e41f4b71Sopenharmony_ci| Value Range | Description | 412e41f4b71Sopenharmony_ci| ------------- | ---------------------------------------------------------- | 413e41f4b71Sopenharmony_ci| number | Blur degree, represented by a fraction. The value **1** means opaque, and **0** means completely transparent.<br>Value range: [0, 1] | 414e41f4b71Sopenharmony_ci| number | Stop position. The value **1** indicates the end position and **0** the end position.<br> Value range: [0, 1]| 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci## InvertOptions<sup>11+</sup> 417e41f4b71Sopenharmony_ci 418e41f4b71Sopenharmony_ciDescribes the options for inverting the foreground color. 419e41f4b71Sopenharmony_ci 420e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 421e41f4b71Sopenharmony_ci 422e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 423e41f4b71Sopenharmony_ci| -------------- | ------ | ----- | ------------------------------------------ | 424e41f4b71Sopenharmony_ci| low | number | Yes | Value when the background color is greater than the grayscale threshold. | 425e41f4b71Sopenharmony_ci| high | number | Yes | Value when the background color is less than the grayscale threshold. | 426e41f4b71Sopenharmony_ci| threshold | number | Yes | Grayscale threshold. | 427e41f4b71Sopenharmony_ci| thresholdRange | number | Yes | Threshold value range.<br>**NOTE**<br>This range defines the upper and lower bounds of the grayscale threshold. The grayscale value changes linearly from high to low within the range.| 428e41f4b71Sopenharmony_ci 429e41f4b71Sopenharmony_ci## freeze<sup>12+</sup> 430e41f4b71Sopenharmony_ci 431e41f4b71Sopenharmony_cifreeze(value: boolean) 432e41f4b71Sopenharmony_ci 433e41f4b71Sopenharmony_ciSets whether to freeze the component. A frozen component can no longer be changed once it and its child components are rendered off the screen: Its attributes cannot be updated across renders. 434e41f4b71Sopenharmony_ci 435e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 436e41f4b71Sopenharmony_ci 437e41f4b71Sopenharmony_ci**Parameters** 438e41f4b71Sopenharmony_ci 439e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 440e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ | 441e41f4b71Sopenharmony_ci| value | boolean | Yes | Whether to freeze the component. A frozen component can no longer be changed once it and its child components are rendered off the screen: Its attributes cannot be updated across renders. If the opacity of the component is not 1, the drawing effect may vary depending on the value.<br>Default value: **false**| 442e41f4b71Sopenharmony_ci 443e41f4b71Sopenharmony_ci## Example 444e41f4b71Sopenharmony_ci 445e41f4b71Sopenharmony_ci### Example 1 446e41f4b71Sopenharmony_ciThis example uses **blur** to apply a foreground blur effect and **backdropBlur** to apply a background blur effect. 447e41f4b71Sopenharmony_ci```ts 448e41f4b71Sopenharmony_ci// xxx.ets 449e41f4b71Sopenharmony_ci@Entry 450e41f4b71Sopenharmony_ci@Component 451e41f4b71Sopenharmony_cistruct BlurEffectsExample { 452e41f4b71Sopenharmony_ci build() { 453e41f4b71Sopenharmony_ci Column({ space: 10 }) { 454e41f4b71Sopenharmony_ci // Blur the font. 455e41f4b71Sopenharmony_ci Text('font blur').fontSize(15).fontColor(0xCCCCCC).width('90%') 456e41f4b71Sopenharmony_ci Flex({ alignItems: ItemAlign.Center }) { 457e41f4b71Sopenharmony_ci Text('original text').margin(10) 458e41f4b71Sopenharmony_ci Text('blur text') 459e41f4b71Sopenharmony_ci .blur(5).margin(10) 460e41f4b71Sopenharmony_ci Text('blur text') 461e41f4b71Sopenharmony_ci .blur(10).margin(10) 462e41f4b71Sopenharmony_ci Text('blur text') 463e41f4b71Sopenharmony_ci .blur(15).margin(10) 464e41f4b71Sopenharmony_ci }.width('90%').height(40) 465e41f4b71Sopenharmony_ci .backgroundColor(0xF9CF93) 466e41f4b71Sopenharmony_ci 467e41f4b71Sopenharmony_ci 468e41f4b71Sopenharmony_ci // Blur the background. 469e41f4b71Sopenharmony_ci Text('backdropBlur').fontSize(15).fontColor(0xCCCCCC).width('90%') 470e41f4b71Sopenharmony_ci Text() 471e41f4b71Sopenharmony_ci .width('90%') 472e41f4b71Sopenharmony_ci .height(40) 473e41f4b71Sopenharmony_ci .fontSize(16) 474e41f4b71Sopenharmony_ci .backdropBlur(3) 475e41f4b71Sopenharmony_ci .backgroundImage($r('app.media.image')) 476e41f4b71Sopenharmony_ci .backgroundImageSize({ width: 1200, height: 160 }) 477e41f4b71Sopenharmony_ci }.width('100%').margin({ top: 5 }) 478e41f4b71Sopenharmony_ci } 479e41f4b71Sopenharmony_ci} 480e41f4b71Sopenharmony_ci``` 481e41f4b71Sopenharmony_ci 482e41f4b71Sopenharmony_ci 483e41f4b71Sopenharmony_ci 484e41f4b71Sopenharmony_ci### Example 2 485e41f4b71Sopenharmony_ciThis example applies different image effects. 486e41f4b71Sopenharmony_ci```ts 487e41f4b71Sopenharmony_ci// xxx.ets 488e41f4b71Sopenharmony_ci@Entry 489e41f4b71Sopenharmony_ci@Component 490e41f4b71Sopenharmony_cistruct ImageEffectsExample { 491e41f4b71Sopenharmony_ci build() { 492e41f4b71Sopenharmony_ci Column({ space: 5 }) { 493e41f4b71Sopenharmony_ci // Apply the shadow effect. 494e41f4b71Sopenharmony_ci Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%') 495e41f4b71Sopenharmony_ci Image($r('app.media.image')) 496e41f4b71Sopenharmony_ci .width('90%') 497e41f4b71Sopenharmony_ci .height(30) 498e41f4b71Sopenharmony_ci .shadow({ radius: 10, color: Color.Green, offsetX: 20, offsetY: 20 }) 499e41f4b71Sopenharmony_ci 500e41f4b71Sopenharmony_ci // Add the internal shadow effect. 501e41f4b71Sopenharmony_ci Text('shadow').fontSize(15).fontColor(0xCCCCCC).width('90%') 502e41f4b71Sopenharmony_ci Image($r('app.media.image')) 503e41f4b71Sopenharmony_ci .width('90%') 504e41f4b71Sopenharmony_ci .height(30) 505e41f4b71Sopenharmony_ci .shadow({ radius: 5, color: Color.Green, offsetX: 20, offsetY: 20,fill:true }).opacity(0.5) 506e41f4b71Sopenharmony_ci 507e41f4b71Sopenharmony_ci // Apply the grayscale effect. The grayscale value ranges from 0 to 1. The closer the grayscale value is to 1, the more obvious the grayscale effect is. 508e41f4b71Sopenharmony_ci Text('grayscale').fontSize(15).fontColor(0xCCCCCC).width('90%') 509e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).grayscale(0.3) 510e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).grayscale(0.8) 511e41f4b71Sopenharmony_ci 512e41f4b71Sopenharmony_ci // Apply the brightness effect. The value 1 indicates no effects. If the value is less than 1, the brightness decreases. If the value is greater than 1, the brightness increases. 513e41f4b71Sopenharmony_ci Text('brightness').fontSize(15).fontColor(0xCCCCCC).width('90%') 514e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).brightness(1.2) 515e41f4b71Sopenharmony_ci 516e41f4b71Sopenharmony_ci // Apply the saturation effect. If the value is 1, the source image is displayed. 517e41f4b71Sopenharmony_ci Text('saturate').fontSize(15).fontColor(0xCCCCCC).width('90%') 518e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).saturate(2.0) 519e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).saturate(0.7) 520e41f4b71Sopenharmony_ci 521e41f4b71Sopenharmony_ci // Apply the contrast effect. If the value is 1, the source image is displayed. If the value is greater than 1, a larger value indicates a higher contrast and a clearer image. If the value is less than 1, a smaller value indicates a lower contrast is. 522e41f4b71Sopenharmony_ci Text('contrast').fontSize(15).fontColor(0xCCCCCC).width('90%') 523e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).contrast(2.0) 524e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).contrast(0.8) 525e41f4b71Sopenharmony_ci 526e41f4b71Sopenharmony_ci // Invert the image. 527e41f4b71Sopenharmony_ci Text('invert').fontSize(15).fontColor(0xCCCCCC).width('90%') 528e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).invert(0.2) 529e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).invert(0.8) 530e41f4b71Sopenharmony_ci 531e41f4b71Sopenharmony_ci // Apply the color blend effect. 532e41f4b71Sopenharmony_ci Text('colorBlend').fontSize(15).fontColor(0xCCCCCC).width('90%') 533e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).colorBlend(Color.Green) 534e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).colorBlend(Color.Blue) 535e41f4b71Sopenharmony_ci 536e41f4b71Sopenharmony_ci // Convert the image color to sepia. 537e41f4b71Sopenharmony_ci Text('sepia').fontSize(15).fontColor(0xCCCCCC).width('90%') 538e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).sepia(0.8) 539e41f4b71Sopenharmony_ci 540e41f4b71Sopenharmony_ci // Apply the hue rotation effect. 541e41f4b71Sopenharmony_ci Text('hueRotate').fontSize(15).fontColor(0xCCCCCC).width('90%') 542e41f4b71Sopenharmony_ci Image($r('app.media.image')).width('90%').height(30).hueRotate(90) 543e41f4b71Sopenharmony_ci }.width('100%').margin({ top: 5 }) 544e41f4b71Sopenharmony_ci } 545e41f4b71Sopenharmony_ci} 546e41f4b71Sopenharmony_ci``` 547e41f4b71Sopenharmony_ci 548e41f4b71Sopenharmony_ci 549e41f4b71Sopenharmony_ci 550e41f4b71Sopenharmony_ci 551e41f4b71Sopenharmony_ci### Example 3 552e41f4b71Sopenharmony_ci 553e41f4b71Sopenharmony_ciThis example applies a linear gradient blur effect to a component. 554e41f4b71Sopenharmony_ci 555e41f4b71Sopenharmony_ci```ts 556e41f4b71Sopenharmony_ci// xxx.ets 557e41f4b71Sopenharmony_ci@Entry 558e41f4b71Sopenharmony_ci@Component 559e41f4b71Sopenharmony_cistruct ImageExample1 { 560e41f4b71Sopenharmony_ci private_resource1:Resource = $r('app.media.testlinearGradientBlurOrigin') 561e41f4b71Sopenharmony_ci @State image_src: Resource = this.private_resource1 562e41f4b71Sopenharmony_ci build() { 563e41f4b71Sopenharmony_ci Column() { 564e41f4b71Sopenharmony_ci Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { 565e41f4b71Sopenharmony_ci Row({ space: 5 }) { 566e41f4b71Sopenharmony_ci Image(this.image_src) 567e41f4b71Sopenharmony_ci .linearGradientBlur(60, { fractionStops: [[0,0],[0,0.33],[1,0.66],[1,1]], direction: GradientDirection.Bottom }) 568e41f4b71Sopenharmony_ci } 569e41f4b71Sopenharmony_ci } 570e41f4b71Sopenharmony_ci } 571e41f4b71Sopenharmony_ci } 572e41f4b71Sopenharmony_ci} 573e41f4b71Sopenharmony_ci 574e41f4b71Sopenharmony_ci``` 575e41f4b71Sopenharmony_ci 576e41f4b71Sopenharmony_ci 577e41f4b71Sopenharmony_ci 578e41f4b71Sopenharmony_ci### Example 4 579e41f4b71Sopenharmony_ciThis example shows how to use **renderGroup**: 580e41f4b71Sopenharmony_ci```ts 581e41f4b71Sopenharmony_ci// xxx.ets 582e41f4b71Sopenharmony_ci@Component 583e41f4b71Sopenharmony_cistruct Component1 { 584e41f4b71Sopenharmony_ci @Prop renderGroupValue: boolean; 585e41f4b71Sopenharmony_ci build() { 586e41f4b71Sopenharmony_ci Row() { 587e41f4b71Sopenharmony_ci Row() { 588e41f4b71Sopenharmony_ci Row() 589e41f4b71Sopenharmony_ci .backgroundColor(Color.Black) 590e41f4b71Sopenharmony_ci .width(100) 591e41f4b71Sopenharmony_ci .height(100) 592e41f4b71Sopenharmony_ci .opacity(1) 593e41f4b71Sopenharmony_ci } 594e41f4b71Sopenharmony_ci .backgroundColor(Color.White) 595e41f4b71Sopenharmony_ci .width(150) 596e41f4b71Sopenharmony_ci .height(150) 597e41f4b71Sopenharmony_ci .justifyContent(FlexAlign.Center) 598e41f4b71Sopenharmony_ci .opacity(0.6) 599e41f4b71Sopenharmony_ci .renderGroup(this.renderGroupValue) 600e41f4b71Sopenharmony_ci } 601e41f4b71Sopenharmony_ci .backgroundColor(Color.Black) 602e41f4b71Sopenharmony_ci .width(200) 603e41f4b71Sopenharmony_ci .height(200) 604e41f4b71Sopenharmony_ci .justifyContent(FlexAlign.Center) 605e41f4b71Sopenharmony_ci .opacity(1) 606e41f4b71Sopenharmony_ci } 607e41f4b71Sopenharmony_ci} 608e41f4b71Sopenharmony_ci@Entry 609e41f4b71Sopenharmony_ci@Component 610e41f4b71Sopenharmony_cistruct RenderGroupExample { 611e41f4b71Sopenharmony_ci build() { 612e41f4b71Sopenharmony_ci Column() { 613e41f4b71Sopenharmony_ci Component1({renderGroupValue: true}) 614e41f4b71Sopenharmony_ci .margin(20) 615e41f4b71Sopenharmony_ci Component1({renderGroupValue: false}) 616e41f4b71Sopenharmony_ci .margin(20) 617e41f4b71Sopenharmony_ci } 618e41f4b71Sopenharmony_ci .width("100%") 619e41f4b71Sopenharmony_ci .height("100%") 620e41f4b71Sopenharmony_ci .alignItems(HorizontalAlign.Center) 621e41f4b71Sopenharmony_ci } 622e41f4b71Sopenharmony_ci} 623e41f4b71Sopenharmony_ci``` 624e41f4b71Sopenharmony_ci 625e41f4b71Sopenharmony_ci 626e41f4b71Sopenharmony_ci 627e41f4b71Sopenharmony_ci### Example 5 628e41f4b71Sopenharmony_ciThis example shows how to use **blendMode** alone: 629e41f4b71Sopenharmony_ci```ts 630e41f4b71Sopenharmony_ci// xxx.ets 631e41f4b71Sopenharmony_ci@Entry 632e41f4b71Sopenharmony_ci@Component 633e41f4b71Sopenharmony_cistruct Index { 634e41f4b71Sopenharmony_ci build() { 635e41f4b71Sopenharmony_ci Column() { 636e41f4b71Sopenharmony_ci Text("blendMode") 637e41f4b71Sopenharmony_ci .fontSize(20) 638e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 639e41f4b71Sopenharmony_ci .fontColor('#ffff0101') 640e41f4b71Sopenharmony_ci Row() { 641e41f4b71Sopenharmony_ci Circle() 642e41f4b71Sopenharmony_ci .width(200) 643e41f4b71Sopenharmony_ci .height(200) 644e41f4b71Sopenharmony_ci .fill(Color.Green) 645e41f4b71Sopenharmony_ci .position({ x: 50, y: 50 }) 646e41f4b71Sopenharmony_ci Circle() 647e41f4b71Sopenharmony_ci .width(200) 648e41f4b71Sopenharmony_ci .height(200) 649e41f4b71Sopenharmony_ci .fill(Color.Blue) 650e41f4b71Sopenharmony_ci .position({ x: 150, y: 50 }) 651e41f4b71Sopenharmony_ci } 652e41f4b71Sopenharmony_ci .blendMode(BlendMode.OVERLAY,BlendApplyType.OFFSCREEN) 653e41f4b71Sopenharmony_ci .alignItems(VerticalAlign.Center) 654e41f4b71Sopenharmony_ci .height(300) 655e41f4b71Sopenharmony_ci .width('100%') 656e41f4b71Sopenharmony_ci } 657e41f4b71Sopenharmony_ci .height('100%') 658e41f4b71Sopenharmony_ci .width('100%') 659e41f4b71Sopenharmony_ci .backgroundImage($r('app.media.image')) 660e41f4b71Sopenharmony_ci .backgroundImageSize(ImageSize.Cover) 661e41f4b71Sopenharmony_ci } 662e41f4b71Sopenharmony_ci} 663e41f4b71Sopenharmony_ci``` 664e41f4b71Sopenharmony_ci 665e41f4b71Sopenharmony_ci<br>BlendMode.OVERLAY,BlendApplyType.OFFSCREEN<br> 666e41f4b71Sopenharmony_ci 667e41f4b71Sopenharmony_ci<br>**blendMode** can be used with offscreen rendering to produce different effects. 668e41f4b71Sopenharmony_ci 669e41f4b71Sopenharmony_ci### Example 6 670e41f4b71Sopenharmony_ci 671e41f4b71Sopenharmony_ciThis example uses **blendMode** with **backgroundEffect** to implement the gradient effect of text and images.<br> 672e41f4b71Sopenharmony_ciIf unwanted lines appear, make sure the sizes of the two owning components of **blendMode** are the same. If the issue persists, the component bounds may have fallen on the floating-point coordinates. In this case, set the universal attribute [pixelRound](ts-universal-attributes-layout-constraints.md#pixelRound11) to align the component bounds on both sides of the unwanted lines with the integer pixel coordinates. 673e41f4b71Sopenharmony_ci 674e41f4b71Sopenharmony_ci```ts 675e41f4b71Sopenharmony_ci// xxx.ets 676e41f4b71Sopenharmony_ci@Entry 677e41f4b71Sopenharmony_ci@Component 678e41f4b71Sopenharmony_cistruct Index { 679e41f4b71Sopenharmony_ci @State shColor: Color = Color.White; 680e41f4b71Sopenharmony_ci @State sizeDate: number = 20; 681e41f4b71Sopenharmony_ci @State rVal: number = 255; 682e41f4b71Sopenharmony_ci @State gVal: number = 255; 683e41f4b71Sopenharmony_ci @State bVal: number = 255; 684e41f4b71Sopenharmony_ci @State aVal: number = 0.1; 685e41f4b71Sopenharmony_ci @State rad: number = 40; 686e41f4b71Sopenharmony_ci @State satVal: number = 0.8; 687e41f4b71Sopenharmony_ci @State briVal: number = 1.5; 688e41f4b71Sopenharmony_ci build() { 689e41f4b71Sopenharmony_ci Stack() { 690e41f4b71Sopenharmony_ci Image($r('app.media.image')) 691e41f4b71Sopenharmony_ci Column() { 692e41f4b71Sopenharmony_ci Column({ space: 0 }) { 693e41f4b71Sopenharmony_ci Column() { 694e41f4b71Sopenharmony_ci Text('11') 695e41f4b71Sopenharmony_ci .fontSize(144) 696e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 697e41f4b71Sopenharmony_ci .fontColor('rgba(255,255,255,1)') 698e41f4b71Sopenharmony_ci .fontFamily('HarmonyOS-Sans-Digit') 699e41f4b71Sopenharmony_ci .maxLines(1) 700e41f4b71Sopenharmony_ci .lineHeight(120 * 1.25) 701e41f4b71Sopenharmony_ci .height(120 * 1.25) 702e41f4b71Sopenharmony_ci .letterSpacing(4 * 1.25) 703e41f4b71Sopenharmony_ci Text('42') 704e41f4b71Sopenharmony_ci .fontSize(144) 705e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 706e41f4b71Sopenharmony_ci .fontColor('rgba(255,255,255,1)') 707e41f4b71Sopenharmony_ci .fontFamily('HarmonyOS-Sans-Digit') 708e41f4b71Sopenharmony_ci .maxLines(1) 709e41f4b71Sopenharmony_ci .lineHeight(120 * 1.25) 710e41f4b71Sopenharmony_ci .height(120 * 1.25) 711e41f4b71Sopenharmony_ci .letterSpacing(4 * 1.25) 712e41f4b71Sopenharmony_ci .shadow({ 713e41f4b71Sopenharmony_ci color: 'rgba(0,0,0,0)', 714e41f4b71Sopenharmony_ci radius: 20, 715e41f4b71Sopenharmony_ci offsetX: 0, 716e41f4b71Sopenharmony_ci offsetY: 0 717e41f4b71Sopenharmony_ci }) 718e41f4b71Sopenharmony_ci Row() { 719e41f4b71Sopenharmony_ci Text ('October 16') 720e41f4b71Sopenharmony_ci .fontSize(this.sizeDate) 721e41f4b71Sopenharmony_ci .height(22) 722e41f4b71Sopenharmony_ci .fontWeight('medium') 723e41f4b71Sopenharmony_ci .fontColor('rgba(255,255,255,1)') 724e41f4b71Sopenharmony_ci Text('Monday') 725e41f4b71Sopenharmony_ci .fontSize(this.sizeDate) 726e41f4b71Sopenharmony_ci .height(22) 727e41f4b71Sopenharmony_ci .fontWeight('medium') 728e41f4b71Sopenharmony_ci .fontColor('rgba(255,255,255,1)') 729e41f4b71Sopenharmony_ci } 730e41f4b71Sopenharmony_ci } 731e41f4b71Sopenharmony_ci .blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN) 732e41f4b71Sopenharmony_ci .pixelRound({ 733e41f4b71Sopenharmony_ci start: PixelRoundCalcPolicy.FORCE_FLOOR , 734e41f4b71Sopenharmony_ci top: PixelRoundCalcPolicy.FORCE_FLOOR , 735e41f4b71Sopenharmony_ci end: PixelRoundCalcPolicy.FORCE_CEIL, 736e41f4b71Sopenharmony_ci bottom: PixelRoundCalcPolicy.FORCE_CEIL 737e41f4b71Sopenharmony_ci }) 738e41f4b71Sopenharmony_ci } 739e41f4b71Sopenharmony_ci .blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN) 740e41f4b71Sopenharmony_ci .backgroundEffect({ 741e41f4b71Sopenharmony_ci radius: this.rad, 742e41f4b71Sopenharmony_ci saturation: this.satVal, 743e41f4b71Sopenharmony_ci brightness: this.briVal, 744e41f4b71Sopenharmony_ci color: this.getVolumeDialogWindowColor() 745e41f4b71Sopenharmony_ci }) 746e41f4b71Sopenharmony_ci .justifyContent(FlexAlign.Center) 747e41f4b71Sopenharmony_ci .pixelRound({ 748e41f4b71Sopenharmony_ci start: PixelRoundCalcPolicy.FORCE_FLOOR , 749e41f4b71Sopenharmony_ci top: PixelRoundCalcPolicy.FORCE_FLOOR , 750e41f4b71Sopenharmony_ci end: PixelRoundCalcPolicy.FORCE_CEIL, 751e41f4b71Sopenharmony_ci bottom: PixelRoundCalcPolicy.FORCE_CEIL 752e41f4b71Sopenharmony_ci }) 753e41f4b71Sopenharmony_ci } 754e41f4b71Sopenharmony_ci } 755e41f4b71Sopenharmony_ci } 756e41f4b71Sopenharmony_ci getVolumeDialogWindowColor(): ResourceColor | string { 757e41f4b71Sopenharmony_ci return `rgba(${this.rVal.toFixed(0)}, ${this.gVal.toFixed(0)}, ${this.bVal.toFixed(0)}, ${this.aVal.toFixed(0)})`; 758e41f4b71Sopenharmony_ci } 759e41f4b71Sopenharmony_ci} 760e41f4b71Sopenharmony_ci``` 761e41f4b71Sopenharmony_ci 762e41f4b71Sopenharmony_ci 763e41f4b71Sopenharmony_ci 764e41f4b71Sopenharmony_ci### Example 7 765e41f4b71Sopenharmony_ciThis example shows how to use **InvertOptions**: 766e41f4b71Sopenharmony_ci```ts 767e41f4b71Sopenharmony_ci// xxx.ets 768e41f4b71Sopenharmony_ci @Entry 769e41f4b71Sopenharmony_ci @Component 770e41f4b71Sopenharmony_ci struct Index { 771e41f4b71Sopenharmony_ci build() { 772e41f4b71Sopenharmony_ci Stack() { 773e41f4b71Sopenharmony_ci Column() 774e41f4b71Sopenharmony_ci Stack(){ 775e41f4b71Sopenharmony_ci Image($r('app.media.r')).width('100%') 776e41f4b71Sopenharmony_ci Column(){ 777e41f4b71Sopenharmony_ci Column().width("100%").height(30).invert({ 778e41f4b71Sopenharmony_ci low:0, 779e41f4b71Sopenharmony_ci high:1, 780e41f4b71Sopenharmony_ci threshold:0.5, 781e41f4b71Sopenharmony_ci thresholdRange:0.2 782e41f4b71Sopenharmony_ci }) 783e41f4b71Sopenharmony_ci Column().width("100%").height(30).invert({ 784e41f4b71Sopenharmony_ci low:0.2, 785e41f4b71Sopenharmony_ci high:0.5, 786e41f4b71Sopenharmony_ci threshold:0.3, 787e41f4b71Sopenharmony_ci thresholdRange:0.2 788e41f4b71Sopenharmony_ci }) 789e41f4b71Sopenharmony_ci } 790e41f4b71Sopenharmony_ci } 791e41f4b71Sopenharmony_ci .width('100%') 792e41f4b71Sopenharmony_ci .height('100%') 793e41f4b71Sopenharmony_ci } 794e41f4b71Sopenharmony_ci } 795e41f4b71Sopenharmony_ci } 796e41f4b71Sopenharmony_ci 797e41f4b71Sopenharmony_ci``` 798e41f4b71Sopenharmony_ci 799e41f4b71Sopenharmony_ci 800e41f4b71Sopenharmony_ci 801e41f4b71Sopenharmony_ci### Example 8 802e41f4b71Sopenharmony_ciThis example shows how to use **UseShadowBatching** with **shadow** to ensure that shadows at the same layer do not overlap: 803e41f4b71Sopenharmony_ci```ts 804e41f4b71Sopenharmony_ci// xxx.ets 805e41f4b71Sopenharmony_ci@Entry 806e41f4b71Sopenharmony_ci@Component 807e41f4b71Sopenharmony_cistruct UseShadowBatchingExample { 808e41f4b71Sopenharmony_ci build() { 809e41f4b71Sopenharmony_ci Column() { 810e41f4b71Sopenharmony_ci Column({ space: 10 }) { 811e41f4b71Sopenharmony_ci Stack() { 812e41f4b71Sopenharmony_ci 813e41f4b71Sopenharmony_ci }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) 814e41f4b71Sopenharmony_ci .shadow({ radius: 120, color: Color.Green, offsetX: 0, offsetY: 0 }) 815e41f4b71Sopenharmony_ci .align(Alignment.TopStart).shadow({ radius: 120, color: Color.Green, offsetX: 0, offsetY: 0 }) 816e41f4b71Sopenharmony_ci 817e41f4b71Sopenharmony_ci Stack() { 818e41f4b71Sopenharmony_ci 819e41f4b71Sopenharmony_ci }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) 820e41f4b71Sopenharmony_ci .align(Alignment.TopStart).shadow({ radius: 120, color: Color.Red, offsetX: 0, offsetY: 0 }) 821e41f4b71Sopenharmony_ci .width('90%') 822e41f4b71Sopenharmony_ci .backgroundColor(Color.White) 823e41f4b71Sopenharmony_ci 824e41f4b71Sopenharmony_ci Column() { 825e41f4b71Sopenharmony_ci Text() 826e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 827e41f4b71Sopenharmony_ci .fontSize(20) 828e41f4b71Sopenharmony_ci .fontColor(Color.White) 829e41f4b71Sopenharmony_ci } 830e41f4b71Sopenharmony_ci .justifyContent(FlexAlign.Center) 831e41f4b71Sopenharmony_ci .width(150) 832e41f4b71Sopenharmony_ci .height(150) 833e41f4b71Sopenharmony_ci .borderRadius(10) 834e41f4b71Sopenharmony_ci .backgroundColor(0xf56c6c) 835e41f4b71Sopenharmony_ci .shadow({ radius: 300, color: Color.Yellow, offsetX: 0, offsetY: 0 }) 836e41f4b71Sopenharmony_ci 837e41f4b71Sopenharmony_ci Column() { 838e41f4b71Sopenharmony_ci Text() 839e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 840e41f4b71Sopenharmony_ci .fontSize(20) 841e41f4b71Sopenharmony_ci .fontColor(Color.White) 842e41f4b71Sopenharmony_ci } 843e41f4b71Sopenharmony_ci .justifyContent(FlexAlign.Center) 844e41f4b71Sopenharmony_ci .width(150) 845e41f4b71Sopenharmony_ci .height(150) 846e41f4b71Sopenharmony_ci .backgroundColor(0x67C23A) 847e41f4b71Sopenharmony_ci .borderRadius(10) 848e41f4b71Sopenharmony_ci .translate({ y: -50}) 849e41f4b71Sopenharmony_ci .shadow({ radius: 220, color: Color.Blue, offsetX: 0, offsetY: 0 }) 850e41f4b71Sopenharmony_ci } 851e41f4b71Sopenharmony_ci .useShadowBatching(true) 852e41f4b71Sopenharmony_ci } 853e41f4b71Sopenharmony_ci .width('100%').margin({ top: 5 }) 854e41f4b71Sopenharmony_ci } 855e41f4b71Sopenharmony_ci} 856e41f4b71Sopenharmony_ci``` 857e41f4b71Sopenharmony_ci 858e41f4b71Sopenharmony_ci 859e41f4b71Sopenharmony_ci 860e41f4b71Sopenharmony_ci### Example 9 861e41f4b71Sopenharmony_ci 862e41f4b71Sopenharmony_ciThis example applies a spherical effect to a component. 863e41f4b71Sopenharmony_ci 864e41f4b71Sopenharmony_ci```ts 865e41f4b71Sopenharmony_ci// xxx.ets 866e41f4b71Sopenharmony_ci@Entry 867e41f4b71Sopenharmony_ci@Component 868e41f4b71Sopenharmony_cistruct SphericalEffectExample { 869e41f4b71Sopenharmony_ci build() { 870e41f4b71Sopenharmony_ci Stack() { 871e41f4b71Sopenharmony_ci TextInput({placeholder: "Enter a percentage."}) 872e41f4b71Sopenharmony_ci .width('50%') 873e41f4b71Sopenharmony_ci .height(35) 874e41f4b71Sopenharmony_ci .type(InputType.Number) 875e41f4b71Sopenharmony_ci .enterKeyType(EnterKeyType.Done) 876e41f4b71Sopenharmony_ci .caretColor(Color.Red) 877e41f4b71Sopenharmony_ci .placeholderColor(Color.Blue) 878e41f4b71Sopenharmony_ci .placeholderFont({ 879e41f4b71Sopenharmony_ci size: 20, 880e41f4b71Sopenharmony_ci style: FontStyle.Italic, 881e41f4b71Sopenharmony_ci weight: FontWeight.Bold 882e41f4b71Sopenharmony_ci }) 883e41f4b71Sopenharmony_ci .sphericalEffect(0.5) 884e41f4b71Sopenharmony_ci }.alignContent(Alignment.Center).width("100%").height("100%") 885e41f4b71Sopenharmony_ci } 886e41f4b71Sopenharmony_ci} 887e41f4b71Sopenharmony_ci 888e41f4b71Sopenharmony_ci``` 889e41f4b71Sopenharmony_ci 890e41f4b71Sopenharmony_ciBelow is how the component looks with the spherical effect applied. 891e41f4b71Sopenharmony_ci 892e41f4b71Sopenharmony_ci 893e41f4b71Sopenharmony_ci 894e41f4b71Sopenharmony_ciBelow is how the component looks without the spherical effect applied. 895e41f4b71Sopenharmony_ci 896e41f4b71Sopenharmony_ci 897e41f4b71Sopenharmony_ci 898e41f4b71Sopenharmony_ci### Example 10 899e41f4b71Sopenharmony_ci 900e41f4b71Sopenharmony_ciThis example applies a light up effect to a component. 901e41f4b71Sopenharmony_ci 902e41f4b71Sopenharmony_ci```ts 903e41f4b71Sopenharmony_ci// xxx.ets 904e41f4b71Sopenharmony_ci@Entry 905e41f4b71Sopenharmony_ci@Component 906e41f4b71Sopenharmony_cistruct LightUpExample { 907e41f4b71Sopenharmony_ci build() { 908e41f4b71Sopenharmony_ci Stack() { 909e41f4b71Sopenharmony_ci Text('This is the text content with letterSpacing 0.') 910e41f4b71Sopenharmony_ci .letterSpacing(0) 911e41f4b71Sopenharmony_ci .fontSize(12) 912e41f4b71Sopenharmony_ci .border({ width: 1 }) 913e41f4b71Sopenharmony_ci .padding(10) 914e41f4b71Sopenharmony_ci .width('50%') 915e41f4b71Sopenharmony_ci .lightUpEffect(0.6) 916e41f4b71Sopenharmony_ci }.alignContent(Alignment.Center).width("100%").height("100%") 917e41f4b71Sopenharmony_ci } 918e41f4b71Sopenharmony_ci} 919e41f4b71Sopenharmony_ci 920e41f4b71Sopenharmony_ci``` 921e41f4b71Sopenharmony_ci 922e41f4b71Sopenharmony_ciBelow is how the component looks with the light up effect applied. 923e41f4b71Sopenharmony_ci 924e41f4b71Sopenharmony_ci 925e41f4b71Sopenharmony_ci 926e41f4b71Sopenharmony_ciBelow is how the component looks with **lightUpEffect** set to **0.2**: 927e41f4b71Sopenharmony_ci 928e41f4b71Sopenharmony_ci 929e41f4b71Sopenharmony_ci 930e41f4b71Sopenharmony_ciBelow is how the component looks without the light up effect applied. 931e41f4b71Sopenharmony_ci 932e41f4b71Sopenharmony_ci 933e41f4b71Sopenharmony_ci 934e41f4b71Sopenharmony_ci### Example 11 935e41f4b71Sopenharmony_ci 936e41f4b71Sopenharmony_ciThis example applies a pixel stretch effect to a component. 937e41f4b71Sopenharmony_ci 938e41f4b71Sopenharmony_ci```ts 939e41f4b71Sopenharmony_ci// xxx.ets 940e41f4b71Sopenharmony_ci@Entry 941e41f4b71Sopenharmony_ci@Component 942e41f4b71Sopenharmony_cistruct PixelStretchExample { 943e41f4b71Sopenharmony_ci build() { 944e41f4b71Sopenharmony_ci Stack() { 945e41f4b71Sopenharmony_ci Text('This is the text content with letterSpacing 0.') 946e41f4b71Sopenharmony_ci .letterSpacing(0) 947e41f4b71Sopenharmony_ci .fontSize(12) 948e41f4b71Sopenharmony_ci .border({ width: 1 }) 949e41f4b71Sopenharmony_ci .padding(10) 950e41f4b71Sopenharmony_ci .clip(false) 951e41f4b71Sopenharmony_ci .width('50%') 952e41f4b71Sopenharmony_ci .pixelStretchEffect({top:10,left:10,right:10,bottom:10 }) 953e41f4b71Sopenharmony_ci }.alignContent(Alignment.Center).width("100%").height("100%") 954e41f4b71Sopenharmony_ci } 955e41f4b71Sopenharmony_ci} 956e41f4b71Sopenharmony_ci 957e41f4b71Sopenharmony_ci``` 958e41f4b71Sopenharmony_ci 959e41f4b71Sopenharmony_ciBelow is how the component looks with the pixel stretch effect applied. 960e41f4b71Sopenharmony_ci 961e41f4b71Sopenharmony_ci 962e41f4b71Sopenharmony_ci 963e41f4b71Sopenharmony_ciBelow is how the component looks without the pixel stretch effect applied. 964e41f4b71Sopenharmony_ci 965e41f4b71Sopenharmony_ci 966e41f4b71Sopenharmony_ci 967e41f4b71Sopenharmony_ci 968e41f4b71Sopenharmony_ci### Example 12 969e41f4b71Sopenharmony_ci 970e41f4b71Sopenharmony_ciThis example applies a system bar effect to a component. 971e41f4b71Sopenharmony_ci 972e41f4b71Sopenharmony_ci```ts 973e41f4b71Sopenharmony_ci// xxx.ets 974e41f4b71Sopenharmony_ci@Entry 975e41f4b71Sopenharmony_ci@Component 976e41f4b71Sopenharmony_cistruct Index { 977e41f4b71Sopenharmony_ci build() { 978e41f4b71Sopenharmony_ci Column() { 979e41f4b71Sopenharmony_ci Stack(){ 980e41f4b71Sopenharmony_ci Image($r('app.media.testImage')).width('100%').height('100%') 981e41f4b71Sopenharmony_ci Column().width(150).height(10) 982e41f4b71Sopenharmony_ci .systemBarEffect() 983e41f4b71Sopenharmony_ci .border({radius:5}) 984e41f4b71Sopenharmony_ci .margin({bottom:80}) 985e41f4b71Sopenharmony_ci }.alignContent(Alignment.Center) 986e41f4b71Sopenharmony_ci } 987e41f4b71Sopenharmony_ci } 988e41f4b71Sopenharmony_ci} 989e41f4b71Sopenharmony_ci 990e41f4b71Sopenharmony_ci``` 991e41f4b71Sopenharmony_ci 992e41f4b71Sopenharmony_ciBelow is how the component looks with the system bar effect applied. 993e41f4b71Sopenharmony_ci 994e41f4b71Sopenharmony_ci 995