harmony 鸿蒙EffectKit
EffectKit
Overview
The EffectKit module provides the basic image processing capabilities, including brightness adjustment, blurring, and grayscale adjustment.
System capability: SystemCapability.Multimedia.Image.Core
Since: 12
Summary
File
Name | Description |
---|---|
effect_filter.h | Declares the APIs of an image effect filter. |
effect_types.h | Declares the data types of the image effect filter. |
Structs
Name | Description |
---|---|
struct OH_Filter_ColorMatrix | Describes a matrix used to create an effect filter. |
Types
Name | Description |
---|---|
typedef struct OH_Filter OH_Filter | Defines a struct for a filter used to generate a filter PixelMap. |
typedef struct OH_PixelmapNative OH_PixelmapNative | Defines a struct for a PixelMap. |
Enums
Name | Description |
---|---|
EffectErrorCode { EFFECT_SUCCESS = 0, EFFECT_BAD_PARAMETER = 401, EFFECT_UNSUPPORTED_OPERATION = 7600201, EFFECT_UNKNOWN_ERROR = 7600901 } | Enumerates the status codes that may be used by the effect filter. |
EffectTileMode { CLAMP = 0, REPEAT, MIRROR, DECAL } | Enumerates the tile modes of the shader effect. |
Functions
Name | Description |
---|---|
EffectErrorCode OH_Filter_CreateEffect (OH_PixelmapNative *pixelmap, OH_Filter **filter) | Creates an OH_Filter object. |
EffectErrorCode OH_Filter_Release (OH_Filter *filter) | Releases an OH_Filter object. |
EffectErrorCode OH_Filter_Blur (OH_Filter *filter, float radius) | Creates the frosted glass effect and adds it to a filter. |
EffectErrorCode OH_Filter_BlurWithTileMode (OH_Filter *filter, float radius, EffectTileMode tileMode) | Creates the frosted glass effect and adds it to a filter. |
EffectErrorCode OH_Filter_Brighten (OH_Filter *filter, float brightness) | Creates the brightening effect and adds it to a filter. |
EffectErrorCode OH_Filter_GrayScale (OH_Filter *filter) | Creates the grayscale effect and adds it to a filter. |
EffectErrorCode OH_Filter_Invert (OH_Filter *filter) | Creates the inverted color effect and adds it to a filter. |
EffectErrorCode OH_Filter_SetColorMatrix (OH_Filter *filter, OH_Filter_ColorMatrix *matrix) | Creates a custom effect through a matrix and adds it to a filter. |
EffectErrorCode OH_Filter_GetEffectPixelMap (OH_Filter *filter, OH_PixelmapNative **pixelmap) | Obtains the PixelMap used to create a filter. |
Type Description
OH_Filter
typedef struct OH_Filter OH_Filter
Description
Defines a struct for a filter used to generate a filter PixelMap.
Since: 12
OH_PixelmapNative
typedef struct OH_PixelmapNative OH_PixelmapNative
Description
Since: 12
Enum Description
EffectErrorCode
enum EffectErrorCode
Description
Enumerates the status codes that may be used by the effect filter.
Since: 12
Value | Description |
---|---|
EFFECT_SUCCESS | Operation successful. |
EFFECT_BAD_PARAMETER | Invalid parameter. |
EFFECT_UNSUPPORTED_OPERATION | Unsupported operation. |
EFFECT_UNKNOWN_ERROR | Unknown error. |
EffectTileMode
enum EffectTileMode
Description
Enumerates the tile modes of the shader effect.
Since: 14
Value | Description |
---|---|
CLAMP | Replicates the edge color if the shader effect draws outside of its original boundary. |
REPEAT | Repeats the shader effect in both horizontal and vertical directions. |
MIRROR | Repeats the shader effect in both horizontal and vertical directions, alternating mirror images. |
DECAL | Renders the shader effect only within the original boundary. |
Function Description
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 |
---|---|
filter | Pointer to the filter. |
radius | Blur radius of the frosted glass effect, in px. |
Returns
Returns a status code defined in 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.
Since: 14
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
radius | Blur radius of the frosted glass effect, in px. |
tileMode | Tile mode of the shader effect. For details about the available options, see EffectTileMode. |
Returns
Returns a status code defined in 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 |
---|---|
filter | Pointer to the filter. |
brightness | Luminance of the brightening effect. The value ranges from 0 to 1. When the value is 0, the image remains unchanged. |
Returns
Returns a status code defined in EffectErrorCode.
OH_Filter_CreateEffect()
EffectErrorCode OH_Filter_CreateEffect (OH_PixelmapNative* pixelmap, OH_Filter** filter )
Description
Creates an OH_Filter object.
Since: 12
Parameters
Name | Description |
---|---|
pixelmap | Pointer to the PixelMap. |
filter | Double pointer to the filter created. |
Returns
Returns a status code defined in 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 |
---|---|
filter | Pointer to the filter. |
pixelmap | Double pointer to the PixelMap obtained. |
Returns
Returns a status code defined in 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 |
---|---|
filter | Pointer to the filter. |
Returns
Returns a status code defined in 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 |
---|---|
filter | Pointer to the filter. |
Returns
Returns a status code defined in EffectErrorCode.
OH_Filter_Release()
EffectErrorCode OH_Filter_Release (OH_Filter* filter)
Description
Releases an OH_Filter object.
Since: 12
Parameters
Name | Description |
---|---|
filter | Pointer to the filter. |
Returns
Returns a status code defined in 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 |
---|---|
filter | Pointer to the filter. |
matrix | Pointer to a custom matrix, which is an OH_Filter_ColorMatrix object. |
Returns
Returns a status code defined in EffectErrorCode.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙DisplaySoloist_ExpectedRateRange
harmony 鸿蒙NativeColorSpaceManager
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦