effect_filter.h
Overview
This file declares the APIs of an image effect filter.
File to import: <native_effect/effect_filter.h>
Library: libnative_effect.so
System capability: SystemCapability.Multimedia.Image.Core
Since: 12
Related module: effectKit
Summary
Functions
Function Description
OH_Filter_CreateEffect()
EffectErrorCode OH_Filter_CreateEffect(OH_PixelmapNative* pixelmap, OH_Filter** filter)
Description
Creates an OH_Filter object.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_PixelmapNative* pixelmap | Pointer to the PixelMap. |
| OH_Filter** filter | Double pointer to the filter created. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_Release()
EffectErrorCode OH_Filter_Release(OH_Filter* filter)
Description
Releases an OH_Filter object.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_Blur()
EffectErrorCode OH_Filter_Blur(OH_Filter* filter, float radius)
Description
Creates the frosted glass effect and adds it to a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
| float radius | Blur radius of the frosted glass effect, in px. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_BlurWithTileMode()
EffectErrorCode OH_Filter_BlurWithTileMode(OH_Filter* filter, float radius, EffectTileMode tileMode)
Description
Creates the frosted glass effect and adds it to a filter. It supports the tiling mode of the shader effect.
Since: 14
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
| float radius | Blur radius of the frosted glass effect, in px. |
| EffectTileMode tileMode | Tile mode of the shader effect. For details about the available options, see EffectTileMode. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. If the operation is successful, EFFECT_SUCCESS is returned. If a parameter is invalid, EFFECT_BAD_PARAMETER is returned. |
OH_Filter_Brighten()
EffectErrorCode OH_Filter_Brighten(OH_Filter* filter, float brightness)
Description
Creates the brightening effect and adds it to a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
| float brightness | Brightness value of the brightening effect, ranging from 0 to 1. When the value is 0, the image brightness remains unchanged. When the value is 1, the image becomes fully brightened. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_GrayScale()
EffectErrorCode OH_Filter_GrayScale(OH_Filter* filter)
Description
Creates the grayscale effect and adds it to a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_Invert()
EffectErrorCode OH_Filter_Invert(OH_Filter* filter)
Description
Creates the inverted color effect and adds it to a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_SetColorMatrix()
EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix)
Description
Creates a custom effect through a matrix and adds it to a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
| OH_Filter_ColorMatrix* matrix | Custom OH_Filter_ColorMatrix used to create the filter. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
OH_Filter_GetEffectPixelMap()
EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap)
Description
Obtains the PixelMap used to create a filter.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Filter* filter | Pointer to the filter. |
| OH_PixelmapNative** pixelmap | Double pointer to the PixelMap obtained. |
Returns
| Type | Description |
|---|---|
| EffectErrorCode | Returns a status code. For details, see EffectErrorCode. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 capi-drawing-gpu-context-h
openharmony 鸿蒙 capi-drawing-nativepixelmap-
openharmony 鸿蒙 capi-nativevsync-oh-nativevsync-expectedraterange
openharmony 鸿蒙 capi-drawing-oh-drawing-brush
openharmony 鸿蒙 capi-drawing-oh-drawing-image-info
openharmony 鸿蒙 capi-drawing-text-linetypography-h
openharmony 鸿蒙 capi-oh-nativeimage-oh-nativeimage
openharmony 鸿蒙 capi-drawing-typeface-h