1# ImageEffect 2 3 4## Overview 5 6The ImageEffect module provides the APIs for editing an image. 7 8For details about the development guide and sample, see [Using ImageEffect to Edit Images](../../media/image/image-effect-guidelines.md). 9 10**Since**: 12 11 12 13## Summary 14 15 16### Files 17 18| Name| Description| 19| -------- | -------- | 20| [image_effect.h](image__effect_8h.md) | Declares the APIs related to the image effector.| 21| [image_effect_errors.h](image__effect__errors_8h.md) | Declares the error codes used by the image effector.| 22| [image_effect_filter.h](image__effect__filter_8h.md) | Declare the APIs related to the image effect filter.| 23 24 25### Structs 26 27| Name| Description| 28| -------- | -------- | 29| union [ImageEffect_DataValue](union_image_effect___data_value.md) | Describes the data values.| 30| struct [ImageEffect_Any](_image_effect___any.md) | Describes the image effect parameters.| 31| struct [ImageEffect_FilterNames](_image_effect___filter_names.md) | Describes the filter name information.| 32| struct [ImageEffect_FilterDelegate](_image_effect___filter_delegate.md) | Describes the callback functions of a custom image effect filter.| 33| struct [ImageEffect_Region](_image_effect___region.md) | Describes the image region.| 34| struct [ImageEffect_Size](_image_effect___size.md) | Describes the image size.| 35 36 37### Macros 38 39| Name| Description| 40| -------- | -------- | 41| [OH_EFFECT_BRIGHTNESS_FILTER](#oh_effect_brightness_filter) "Brightness" | Brightness filter. The corresponding parameter is **OH_EFFECT_FILTER_INTENSITY_KEY** and the parameter type is **EFFECT_DATA_TYPE_FLOAT**.| 42| [OH_EFFECT_CONTRAST_FILTER](#oh_effect_contrast_filter) "Contrast" | Contrast filter. The corresponding parameter is **OH_EFFECT_FILTER_INTENSITY_KEY** and the parameter type is **EFFECT_DATA_TYPE_FLOAT**.| 43| [OH_EFFECT_CROP_FILTER](#oh_effect_crop_filter) "Crop" | Crop filter. The corresponding parameter is **OH_EFFECT_FILTER_REGION_KEY**, the parameter type is **EFFECT_DATA_TYPE_PTR**, and the parameter value is [ImageEffect_Region](_image_effect___region.md).| 44| [OH_EFFECT_FILTER_INTENSITY_KEY](#oh_effect_filter_intensity_key) "FilterIntensity" | Intensity filter.| 45| [OH_EFFECT_FILTER_REGION_KEY](#oh_effect_filter_region_key) "FilterRegion" | Image region filter.| 46 47 48### Types 49 50| Name| Description| 51| -------- | -------- | 52| typedef struct [OH_ImageEffect](#oh_imageeffect) [OH_ImageEffect](#oh_imageeffect) | Defines a struct for the image effector.| 53| typedef enum [ImageEffect_ErrorCode](#imageeffect_errorcode-1) [ImageEffect_ErrorCode](#imageeffect_errorcode) | Defines an enum for the error codes used by the image effector.| 54| typedef struct [OH_EffectFilter](#oh_effectfilter) [OH_EffectFilter](#oh_effectfilter) | Defines a struct for the image effect filter.| 55| typedef enum [ImageEffect_DataType](#imageeffect_datatype) [ImageEffect_DataType](#imageeffect_datatype) | Defines an enum for the data types.| 56| typedef union [ImageEffect_DataValue](union_image_effect___data_value.md) [ImageEffect_DataValue](#imageeffect_datavalue) | Defines a union for the data values.| 57| typedef struct [ImageEffect_Any](_image_effect___any.md) [ImageEffect_Any](#imageeffect_any) | Defines a struct for the image effect parameters.| 58| typedef enum [ImageEffect_Format](#imageeffect_format-1) [ImageEffect_Format](#imageeffect_format) | Defines an enum for the pixel formats.| 59| typedef enum [ImageEffect_BufferType](#imageeffect_buffertype-1) [ImageEffect_BufferType](#imageeffect_buffertype) | Defines an enum for the buffer types.| 60| typedef struct [OH_EffectFilterInfo](#oh_effectfilterinfo) [OH_EffectFilterInfo](#oh_effectfilterinfo) | Defines a struct for the image effect filter information.| 61| typedef struct [ImageEffect_FilterNames](_image_effect___filter_names.md) [ImageEffect_FilterNames](#imageeffect_filternames) | Defines a struct for the filter name information.| 62| typedef struct [OH_EffectBufferInfo](#oh_effectbufferinfo) [OH_EffectBufferInfo](#oh_effectbufferinfo) | Defines a struct for the image buffer information.| 63| typedef bool(\* [OH_EffectFilterDelegate_SetValue](#oh_effectfilterdelegate_setvalue)) ([OH_EffectFilter](#oh_effectfilter) \*filter, const char \*key, const [ImageEffect_Any](_image_effect___any.md) \*value) | Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.| 64| typedef void(\* [OH_EffectFilterDelegate_PushData](#oh_effectfilterdelegate_pushdata)) ([OH_EffectFilter](#oh_effectfilter) \*filter, [OH_EffectBufferInfo](#oh_effectbufferinfo) \*info) | Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter.| 65| typedef bool(\* [OH_EffectFilterDelegate_Render](#oh_effectfilterdelegate_render)) ([OH_EffectFilter](#oh_effectfilter) \*filter, [OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, [OH_EffectFilterDelegate_PushData](#oh_effectfilterdelegate_pushdata) pushData) | Defines a pointer to the callback function for rendering an image using a custom filter.| 66| typedef bool(\* [OH_EffectFilterDelegate_Save](#oh_effectfilterdelegate_save)) ([OH_EffectFilter](#oh_effectfilter) \*filter, char \*\*info) | Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.| 67| typedef [OH_EffectFilter](#oh_effectfilter) \*(\* [OH_EffectFilterDelegate_Restore](#oh_effectfilterdelegate_restore)) (const char \*info) | Defines a pointer to the callback function for deserializing a custom filter.| 68| typedef struct [ImageEffect_FilterDelegate](_image_effect___filter_delegate.md) [ImageEffect_FilterDelegate](#imageeffect_filterdelegate) | Defines a struct for the callback functions of a custom image effect filter.| 69| typedef struct [ImageEffect_Region](_image_effect___region.md) [ImageEffect_Region](#imageeffect_region) | Defines a struct for the image region.| 70| typedef struct [ImageEffect_Size](_image_effect___size.md) [ImageEffect_Size](#imageeffect_size) | Defines a struct for the image size.| 71 72 73### Enums 74 75| Name| Description| 76| -------- | -------- | 77| [ImageEffect_ErrorCode](#imageeffect_errorcode-1) {<br>EFFECT_SUCCESS = 0, EFFECT_ERROR_PERMISSION_DENIED = 201,<br>EFFECT_ERROR_PARAM_INVALID = 401, EFFECT_BUFFER_SIZE_NOT_MATCH = 29000001,<br>EFFECT_COLOR_SPACE_NOT_MATCH = 29000002, EFFECT_INPUT_OUTPUT_NOT_MATCH = 29000101,<br>EFFECT_EFFECT_NUMBER_LIMITED = 29000102, EFFECT_INPUT_OUTPUT_NOT_SUPPORTED = 29000103,<br>EFFECT_ALLOCATE_MEMORY_FAILED = 29000104, EFFECT_PARAM_ERROR = 29000121,<br>EFFECT_KEY_ERROR = 29000122, EFFECT_UNKNOWN = 29000199<br>} | Enumerates the error codes used by the image effector.| 78| [ImageEffect_DataType](#imageeffect_datatype-1) {<br>EFFECT_DATA_TYPE_UNKNOWN = 0, EFFECT_DATA_TYPE_INT32 = 1,<br>EFFECT_DATA_TYPE_FLOAT = 2, EFFECT_DATA_TYPE_DOUBLE = 3,<br>EFFECT_DATA_TYPE_CHAR = 4, EFFECT_DATA_TYPE_LONG = 5,<br>EFFECT_DATA_TYPE_BOOL = 6, EFFECT_DATA_TYPE_PTR = 7<br>} | Enumerates the data types.| 79| [ImageEffect_Format](#imageeffect_format-1) {<br>EFFECT_PIXEL_FORMAT_UNKNOWN = 0, EFFECT_PIXEL_FORMAT_RGBA8888 = 1,<br>EFFECT_PIXEL_FORMAT_NV21 = 2, EFFECT_PIXEL_FORMAT_NV12 = 3,<br>EFFECT_PIXEL_FORMAT_RGBA1010102 = 4, EFFECT_PIXEL_FORMAT_YCBCR_P010 = 5,<br>EFFECT_PIXEL_FORMAT_YCRCB_P010 = 6<br>} | Enumerates the pixel formats.| 80| [ImageEffect_BufferType](#imageeffect_buffertype-1) { EFFECT_BUFFER_TYPE_UNKNOWN = 0,<br>EFFECT_BUFFER_TYPE_PIXEL = 1, EFFECT_BUFFER_TYPE_TEXTURE = 2 } | Enumerates the buffer types.| 81 82 83### Functions 84 85| Name| Description| 86| -------- | -------- | 87| [OH_ImageEffect](#oh_imageeffect) \* [OH_ImageEffect_Create](#oh_imageeffect_create) (const char \*name) | Creates an **OH_ImageEffect** instance. The instance must be released by calling [OH_ImageEffect_Release](#oh_imageeffect_release) when it is no longer needed.| 88| [OH_EffectFilter](#oh_effectfilter) \* [OH_ImageEffect_AddFilter](#oh_imageeffect_addfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, const char \*filterName) | Adds a filter.| 89| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_AddFilterByFilter](#oh_imageeffect_addfilterbyfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, [OH_EffectFilter](#oh_effectfilter) \*filter) | Adds a specified filter. | 90| [OH_EffectFilter](#oh_effectfilter) \* [OH_ImageEffect_InsertFilter](#oh_imageeffect_insertfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index, const char \*filterName) | Inserts a filter.| 91| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_InsertFilterByFilter](#oh_imageeffect_insertfilterbyfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index, [OH_EffectFilter](#oh_effectfilter) \*filter) | Inserts a filter to the specified position. | 92| int32_t [OH_ImageEffect_RemoveFilter](#oh_imageeffect_removefilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, const char \*filterName) | Removes a filter.| 93| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_RemoveFilterByIndex](#oh_imageeffect_removefilterbyindex) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index) | Removes a filter from the specified position. | 94| [OH_EffectFilter](#oh_effectfilter) \* [OH_ImageEffect_ReplaceFilter](#oh_imageeffect_replacefilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index, const char \*filterName) | Replaces a filter. | 95| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_ReplaceFilterByFilter](#oh_imageeffect_replacefilterbyfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index, const char \*filterName) | Replaces a filter at the specified position. | 96| int32_t [OH_ImageEffect_GetFilterCount](#oh_imageeffect_getfiltercount) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect) | Obtains the number of added filters.| 97| [OH_EffectFilter](#oh_effectfilter) \* [OH_ImageEffect_GetFilter](#oh_imageeffect_getfilter) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, uint32_t index) | Obtains the information about a filter.| 98| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_Configure](#oh_imageeffect_configure) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, const char \*key, const [ImageEffect_Any](_image_effect___any.md) \*value) | Configures an image effector.| 99| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetOutputSurface](#oh_imageeffect_setoutputsurface) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OHNativeWindow \*nativeWindow) | Sets an output surface.| 100| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_GetInputSurface](#oh_imageeffect_getinputsurface) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OHNativeWindow \*\*nativeWindow) | Obtains an input surface.| 101| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetInputPixelmap](#oh_imageeffect_setinputpixelmap) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_PixelmapNative \*pixelmap) | Sets an input PixelMap.| 102| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetOutputPixelmap](#oh_imageeffect_setoutputpixelmap) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_PixelmapNative \*pixelmap) | Sets an output PixelMap.| 103| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetInputNativeBuffer](#oh_imageeffect_setinputnativebuffer) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_NativeBuffer \*nativeBuffer) | Sets an input native buffer.| 104| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetOutputNativeBuffer](#oh_imageeffect_setoutputnativebuffer) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_NativeBuffer \*nativeBuffer) | Sets an output native buffer.| 105| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetInputUri](#oh_imageeffect_setinputuri) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, const char \*uri) | Sets an input URI.| 106| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetOutputUri](#oh_imageeffect_setoutputuri) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, const char \*uri) | Sets an output URI.| 107| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetInputPicture](#oh_imageeffect_setinputpicture) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_PictureNative \*picture) | Sets an input picture. | 108| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_SetOutputPicture](#oh_imageeffect_setoutputpicture) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, OH_PictureNative \*picture) | Sets an output picture. | 109| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_Start](#oh_imageeffect_start) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect) | Starts an image effector.| 110| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_Stop](#oh_imageeffect_stop) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect) | Stops an image effector.| 111| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_Release](#oh_imageeffect_release) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect) | Releases an **OH_ImageEffect** instance.| 112| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_ImageEffect_Save](#oh_imageeffect_save) ([OH_ImageEffect](#oh_imageeffect) \*imageEffect, char \*\*info) | Serializes an image effector.| 113| [OH_ImageEffect](#oh_imageeffect) \* [OH_ImageEffect_Restore](#oh_imageeffect_restore) (const char \*info) | Deserializes an image effector.| 114| [OH_EffectFilterInfo](#oh_effectfilterinfo) \* [OH_EffectFilterInfo_Create](#oh_effectfilterinfo_create) () | Creates an **OH_EffectFilterInfo** instance. The instance must be released by calling [OH_EffectFilterInfo_Release](#oh_effectfilterinfo_release) when it is no longer needed.| 115| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_SetFilterName](#oh_effectfilterinfo_setfiltername) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, const char \*name) | Sets a filter name.| 116| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_GetFilterName](#oh_effectfilterinfo_getfiltername) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, char \*\*name) | Obtains a filter name.| 117| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_SetSupportedBufferTypes](#oh_effectfilterinfo_setsupportedbuffertypes) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, uint32_t size, [ImageEffect_BufferType](#imageeffect_buffertype) \*bufferTypeArray) | Sets the buffer types supported by a filter.| 118| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_GetSupportedBufferTypes](#oh_effectfilterinfo_getsupportedbuffertypes) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, uint32_t \*size, [ImageEffect_BufferType](#imageeffect_buffertype) \*\*bufferTypeArray) | Obtains the buffer types supported by a filter.| 119| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_SetSupportedFormats](#oh_effectfilterinfo_setsupportedformats) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, uint32_t size, [ImageEffect_Format](#imageeffect_format) \*formatArray) | Sets the pixel formats supported by a filter.| 120| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_GetSupportedFormats](#oh_effectfilterinfo_getsupportedformats) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, uint32_t \*size, [ImageEffect_Format](#imageeffect_format) \*\*formatArray) | Obtains the pixel formats supported by a filter.| 121| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilterInfo_Release](#oh_effectfilterinfo_release) ([OH_EffectFilterInfo](#oh_effectfilterinfo) \*info) | Destroys an **OH_EffectFilterInfo** instance.| 122| [OH_EffectBufferInfo](#oh_effectbufferinfo) \* [OH_EffectBufferInfo_Create](#oh_effectbufferinfo_create) () | Creates an **OH_EffectBufferInfo** instance. The instance must be released by calling [OH_EffectBufferInfo_Release](#oh_effectbufferinfo_release) when it is no longer needed.| 123| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_SetAddr](#oh_effectbufferinfo_setaddr) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, void \*addr) | Sets the address of an effect buffer.| 124| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_GetAddr](#oh_effectbufferinfo_getaddr) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, void \*\*addr) | Obtains the address of an effect buffer.| 125| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_SetWidth](#oh_effectbufferinfo_setwidth) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t width) | Sets the image width.| 126| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_GetWidth](#oh_effectbufferinfo_getwidth) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t \*width) | Obtains the image width.| 127| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_SetHeight](#oh_effectbufferinfo_setheight) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t height) | Sets the image height.| 128| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_GetHeight](#oh_effectbufferinfo_getheight) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t \*height) | Obtains the image height.| 129| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_SetRowSize](#oh_effectbufferinfo_setrowsize) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t rowSize) | Sets the number of bytes per row for an image.| 130| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_GetRowSize](#oh_effectbufferinfo_getrowsize) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, int32_t \*rowSize) | Obtains the number of bytes per row of an image.| 131| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_SetEffectFormat](#oh_effectbufferinfo_seteffectformat) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, [ImageEffect_Format](#imageeffect_format) format) | Sets the pixel format for an image.| 132| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_GetEffectFormat](#oh_effectbufferinfo_geteffectformat) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info, [ImageEffect_Format](#imageeffect_format) \*format) | Obtains the pixel format of an image.| 133| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectBufferInfo_Release](#oh_effectbufferinfo_release) ([OH_EffectBufferInfo](#oh_effectbufferinfo) \*info) | Destroys an **OH_EffectBufferInfo** instance.| 134| [OH_EffectFilter](#oh_effectfilter) \* [OH_EffectFilter_Create](#oh_effectfilter_create) (const char \*name) | Creates an **OH_EffectFilter** instance. The instance must be released by calling [OH_EffectFilter_Release](#oh_effectfilter_release) when it is no longer needed.| 135| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_SetValue](#oh_effectfilter_setvalue) ([OH_EffectFilter](#oh_effectfilter) \*filter, const char \*key, const [ImageEffect_Any](_image_effect___any.md) \*value) | Sets a filter parameter.| 136| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_GetValue](#oh_effectfilter_getvalue) ([OH_EffectFilter](#oh_effectfilter) \*filter, const char \*key, [ImageEffect_Any](_image_effect___any.md) \*value) | Obtains a filter parameter.| 137| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_Register](#oh_effectfilter_register) (const [OH_EffectFilterInfo](#oh_effectfilterinfo) \*info, const [ImageEffect_FilterDelegate](_image_effect___filter_delegate.md) \*delegate) | Registers a custom filter.| 138| [ImageEffect_FilterNames](_image_effect___filter_names.md) \* [OH_EffectFilter_LookupFilters](#oh_effectfilter_lookupfilters) (const char \*key) | Obtains filters that meet given conditions.| 139| void [OH_EffectFilter_ReleaseFilterNames](#oh_effectfilter_releasefilternames) () | Releases filter name memory resources.| 140| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_LookupFilterInfo](#oh_effectfilter_lookupfilterinfo) (const char \*name, [OH_EffectFilterInfo](#oh_effectfilterinfo) \*info) | Obtains the filter information.| 141| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_Render](#oh_effectfilter_render) ([OH_EffectFilter](#oh_effectfilter) \*filter, OH_PixelmapNative \*inputPixelmap, OH_PixelmapNative \*outputPixelmap) | Starts image rendering.| 142| [ImageEffect_ErrorCode](#imageeffect_errorcode) [OH_EffectFilter_Release](#oh_effectfilter_release) ([OH_EffectFilter](#oh_effectfilter) \*filter) | Destroys an **OH_EffectFilter** instance.| 143 144 145## Macro Description 146 147 148### OH_EFFECT_BRIGHTNESS_FILTER 149 150``` 151#define OH_EFFECT_BRIGHTNESS_FILTER "Brightness" 152``` 153 154**Description** 155 156Brightness filter. The corresponding parameter is **OH_EFFECT_FILTER_INTENSITY_KEY** and the parameter type is **EFFECT_DATA_TYPE_FLOAT**. 157 158**System capability**: SystemCapability.Multimedia.ImageEffect.Core 159 160**Since**: 12 161 162 163### OH_EFFECT_CONTRAST_FILTER 164 165``` 166#define OH_EFFECT_CONTRAST_FILTER "Contrast" 167``` 168 169**Description** 170 171Contrast filter. The corresponding parameter is **OH_EFFECT_FILTER_INTENSITY_KEY** and the parameter type is **EFFECT_DATA_TYPE_FLOAT**. 172 173**System capability**: SystemCapability.Multimedia.ImageEffect.Core 174 175**Since**: 12 176 177 178### OH_EFFECT_CROP_FILTER 179 180``` 181#define OH_EFFECT_CROP_FILTER "Crop" 182``` 183 184**Description** 185 186Crop filter. The corresponding parameter is **OH_EFFECT_FILTER_REGION_KEY**, the parameter type is **EFFECT_DATA_TYPE_PTR**, and the parameter value is [ImageEffect_Region](_image_effect___region.md). 187 188**System capability**: SystemCapability.Multimedia.ImageEffect.Core 189 190**Since**: 12 191 192 193### OH_EFFECT_FILTER_INTENSITY_KEY 194 195``` 196#define OH_EFFECT_FILTER_INTENSITY_KEY "FilterIntensity" 197``` 198 199**Description** 200 201Intensity filter. 202 203**System capability**: SystemCapability.Multimedia.ImageEffect.Core 204 205**Since**: 12 206 207 208### OH_EFFECT_FILTER_REGION_KEY 209 210``` 211#define OH_EFFECT_FILTER_REGION_KEY "FilterRegion" 212``` 213 214**Description** 215 216Image region filter. 217 218**System capability**: SystemCapability.Multimedia.ImageEffect.Core 219 220**Since**: 12 221 222 223## Type Description 224 225 226### ImageEffect_Any 227 228``` 229typedef struct ImageEffect_Any ImageEffect_Any 230``` 231 232**Description** 233 234Defines a struct for the image effect parameters. 235 236**System capability**: SystemCapability.Multimedia.ImageEffect.Core 237 238**Since**: 12 239 240 241### ImageEffect_BufferType 242 243``` 244typedef enum ImageEffect_BufferType ImageEffect_BufferType 245``` 246 247**Description** 248 249Defines an enum for the buffer types. 250 251**System capability**: SystemCapability.Multimedia.ImageEffect.Core 252 253**Since**: 12 254 255 256### ImageEffect_DataType 257 258``` 259typedef enum ImageEffect_DataType ImageEffect_DataType 260``` 261 262**Description** 263 264Defines an enum for the data types. 265 266**System capability**: SystemCapability.Multimedia.ImageEffect.Core 267 268**Since**: 12 269 270 271### ImageEffect_DataValue 272 273``` 274typedef union ImageEffect_DataValue ImageEffect_DataValue 275``` 276 277**Description** 278 279Defines a union for the data values. 280 281**System capability**: SystemCapability.Multimedia.ImageEffect.Core 282 283**Since**: 12 284 285 286### ImageEffect_ErrorCode 287 288``` 289typedef enum ImageEffect_ErrorCode ImageEffect_ErrorCode 290``` 291 292**Description** 293 294Defines an enum for the error codes used by the image effector. 295 296**System capability**: SystemCapability.Multimedia.ImageEffect.Core 297 298**Since**: 12 299 300 301### ImageEffect_FilterDelegate 302 303``` 304typedef struct ImageEffect_FilterDelegate ImageEffect_FilterDelegate 305``` 306 307**Description** 308 309Defines a struct for the callback functions of a custom image effect filter. 310 311**System capability**: SystemCapability.Multimedia.ImageEffect.Core 312 313**Since**: 12 314 315 316### ImageEffect_FilterNames 317 318``` 319typedef struct ImageEffect_FilterNames ImageEffect_FilterNames 320``` 321 322**Description** 323 324Defines a struct for the filter name information. 325 326**System capability**: SystemCapability.Multimedia.ImageEffect.Core 327 328**Since**: 12 329 330 331### ImageEffect_Format 332 333``` 334typedef enum ImageEffect_Format ImageEffect_Format 335``` 336 337**Description** 338 339Defines an enum for the pixel formats. 340 341**System capability**: SystemCapability.Multimedia.ImageEffect.Core 342 343**Since**: 12 344 345 346### ImageEffect_Region 347 348``` 349typedef struct ImageEffect_Region ImageEffect_Region 350``` 351 352**Description** 353 354Defines a struct for the image region. 355 356**System capability**: SystemCapability.Multimedia.ImageEffect.Core 357 358**Since**: 12 359 360 361### ImageEffect_Size 362 363``` 364typedef struct ImageEffect_Size ImageEffect_Size 365``` 366 367**Description** 368 369Defines a struct for the image size. 370 371**System capability**: SystemCapability.Multimedia.ImageEffect.Core 372 373**Since**: 12 374 375 376### OH_EffectBufferInfo 377 378``` 379typedef struct OH_EffectBufferInfo OH_EffectBufferInfo 380``` 381 382**Description** 383 384Defines a struct for the image buffer information. 385 386**System capability**: SystemCapability.Multimedia.ImageEffect.Core 387 388**Since**: 12 389 390 391### OH_EffectFilter 392 393``` 394typedef struct OH_EffectFilter OH_EffectFilter 395``` 396 397**Description** 398 399Defines a struct for the image effect filter. 400 401**System capability**: SystemCapability.Multimedia.ImageEffect.Core 402 403**Since**: 12 404 405 406### OH_EffectFilterDelegate_PushData 407 408``` 409typedef void(* OH_EffectFilterDelegate_PushData) (OH_EffectFilter *filter, OH_EffectBufferInfo *info) 410``` 411 412**Description** 413 414Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter. The function pointer must be actively called in the callback of [OH_EffectFilterDelegate_Render](#oh_effectfilterdelegate_render). 415 416**System capability**: SystemCapability.Multimedia.ImageEffect.Core 417 418**Since**: 12 419 420**Parameters** 421 422| Name| Description| 423| -------- | -------- | 424| filter | Pointer to the filter.| 425| info | Pointer to the buffer information, which is [OH_EffectBufferInfo](#oh_effectbufferinfo).| 426 427 428### OH_EffectFilterDelegate_Render 429 430``` 431typedef bool(* OH_EffectFilterDelegate_Render) (OH_EffectFilter *filter, OH_EffectBufferInfo *info, OH_EffectFilterDelegate_PushData pushData) 432``` 433 434**Description** 435 436Defines a pointer to the callback function for rendering an image using a custom filter. 437 438**System capability**: SystemCapability.Multimedia.ImageEffect.Core 439 440**Since**: 12 441 442**Parameters** 443 444| Name| Description| 445| -------- | -------- | 446| filter | Pointer to the filter.| 447| info | Pointer to the buffer information, which is [OH_EffectBufferInfo](#oh_effectbufferinfo).| 448| pushData | Callback function [OH_EffectFilterDelegate_PushData](#oh_effectfilterdelegate_pushdata) used by the custom filter to push image data to the next-level filter.| 449 450**Returns** 451 452Returns **true** if the operation is successful; returns **false** otherwise. 453 454 455### OH_EffectFilterDelegate_Restore 456 457``` 458typedef OH_EffectFilter*(* OH_EffectFilterDelegate_Restore) (const char *info) 459``` 460 461**Description** 462 463Defines a pointer to the callback function for deserializing a custom filter. 464 465**System capability**: SystemCapability.Multimedia.ImageEffect.Core 466 467**Since**: 12 468 469**Parameters** 470 471| Name| Description| 472| -------- | -------- | 473| info | Pointer to a serialized JSON string.| 474 475**Returns** 476 477Returns an **OH_EffectFilter** instance if the operation is successful; returns a null pointer otherwise. 478 479 480### OH_EffectFilterDelegate_Save 481 482``` 483typedef bool(* OH_EffectFilterDelegate_Save) (OH_EffectFilter *filter, char **info) 484``` 485 486**Description** 487 488Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format. 489 490**System capability**: SystemCapability.Multimedia.ImageEffect.Core 491 492**Since**: 12 493 494**Parameters** 495 496| Name| Description| 497| -------- | -------- | 498| filter | Pointer to the filter.| 499| info | Double pointer to a char array holding a serialized JSON string.| 500 501**Returns** 502 503Returns **true** if the operation is successful; returns **false** otherwise. 504 505 506### OH_EffectFilterDelegate_SetValue 507 508``` 509typedef bool(* OH_EffectFilterDelegate_SetValue) (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value) 510``` 511 512**Description** 513 514Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values. 515 516**System capability**: SystemCapability.Multimedia.ImageEffect.Core 517 518**Since**: 12 519 520**Parameters** 521 522| Name| Description| 523| -------- | -------- | 524| filter | Pointer to the filter.| 525| key | Pointer to the key of a filter parameter.| 526| value | Pointer to the value of the filter parameter.| 527 528**Returns** 529 530Returns **true** if the parameter is valid; returns **false** otherwise. 531 532 533### OH_EffectFilterInfo 534 535``` 536typedef struct OH_EffectFilterInfo OH_EffectFilterInfo 537``` 538 539**Description** 540 541Defines a struct for the image effect filter information. 542 543**System capability**: SystemCapability.Multimedia.ImageEffect.Core 544 545**Since**: 12 546 547 548### OH_ImageEffect 549 550``` 551typedef struct OH_ImageEffect OH_ImageEffect 552``` 553 554**Description** 555 556Defines a struct for the image effector. 557 558**System capability**: SystemCapability.Multimedia.ImageEffect.Core 559 560**Since**: 12 561 562 563## Enum Description 564 565 566### ImageEffect_BufferType 567 568``` 569enum ImageEffect_BufferType 570``` 571 572**Description** 573 574Enumerates the buffer types. 575 576**System capability**: SystemCapability.Multimedia.ImageEffect.Core 577 578**Since**: 12 579 580| Value| Description| 581| -------- | -------- | 582| EFFECT_BUFFER_TYPE_UNKNOWN | Undefined type.| 583| EFFECT_BUFFER_TYPE_PIXEL | Pixel image type.| 584| EFFECT_BUFFER_TYPE_TEXTURE | Texture type.| 585 586 587### ImageEffect_DataType 588 589``` 590enum ImageEffect_DataType 591``` 592 593**Description** 594 595Enumerates the data types. 596 597**System capability**: SystemCapability.Multimedia.ImageEffect.Core 598 599**Since**: 12 600 601| Value| Description| 602| -------- | -------- | 603| EFFECT_DATA_TYPE_UNKNOWN | Undefined type.| 604| EFFECT_DATA_TYPE_INT32 | Integer.| 605| EFFECT_DATA_TYPE_FLOAT | Single-precision floating point.| 606| EFFECT_DATA_TYPE_DOUBLE | Double-precision floating point.| 607| EFFECT_DATA_TYPE_CHAR | Byte.| 608| EFFECT_DATA_TYPE_LONG | Long integer.| 609| EFFECT_DATA_TYPE_BOOL | Boolean.| 610| EFFECT_DATA_TYPE_PTR | Pointer.| 611 612 613### ImageEffect_ErrorCode 614 615``` 616enum ImageEffect_ErrorCode 617``` 618 619**Description** 620 621Enumerates the error codes used by the image effector. 622 623**System capability**: SystemCapability.Multimedia.ImageEffect.Core 624 625**Since**: 12 626 627| Value| Description| 628| -------- | -------- | 629| EFFECT_SUCCESS | The operation is successful.| 630| EFFECT_ERROR_PERMISSION_DENIED | Permission verification fails.| 631| EFFECT_ERROR_PARAM_INVALID | Parameter check fails.| 632| EFFECT_BUFFER_SIZE_NOT_MATCH | The output buffer size does not match.| 633| EFFECT_COLOR_SPACE_NOT_MATCH | The input and output color spaces do not match.| 634| EFFECT_INPUT_OUTPUT_NOT_MATCH | The input and output configurations do not match. For example, the input is a surface, but the output is a PixelMap.| 635| EFFECT_EFFECT_NUMBER_LIMITED | The maximum number is reached.| 636| EFFECT_INPUT_OUTPUT_NOT_SUPPORTED | The input or output configuration is not supported.| 637| EFFECT_ALLOCATE_MEMORY_FAILED | Requesting for the buffer fails.| 638| EFFECT_PARAM_ERROR | Invalid parameter value. For example, the filter parameter value is invalid.| 639| EFFECT_KEY_ERROR | Invalid parameter. For example, the filter parameter is invalid.| 640| EFFECT_UNKNOWN | Undefined error.| 641 642 643### ImageEffect_Format 644 645``` 646enum ImageEffect_Format 647``` 648 649**Description** 650 651Enumerates the pixel formats. 652 653**System capability**: SystemCapability.Multimedia.ImageEffect.Core 654 655**Since**: 12 656 657| Value| Description| 658| -------- | -------- | 659| EFFECT_PIXEL_FORMAT_UNKNOWN | Undefined format.| 660| EFFECT_PIXEL_FORMAT_RGBA8888 | RGBA8888.| 661| EFFECT_PIXEL_FORMAT_NV21 | NV21.| 662| EFFECT_PIXEL_FORMAT_NV12 | NV12.| 663| EFFECT_PIXEL_FORMAT_RGBA1010102 | 10-bit RGBA.| 664| EFFECT_PIXEL_FORMAT_YCBCR_P010 | 10-bit YCBCR420.| 665| EFFECT_PIXEL_FORMAT_YCRCB_P010 | 10-bit YCRCB420.| 666 667 668## Function Description 669 670 671### OH_EffectBufferInfo_Create() 672 673``` 674OH_EffectBufferInfo* OH_EffectBufferInfo_Create () 675``` 676 677**Description** 678 679Creates an **OH_EffectBufferInfo** instance. The instance must be released by calling [OH_EffectBufferInfo_Release](#oh_effectbufferinfo_release) when it is no longer needed. 680 681**System capability**: SystemCapability.Multimedia.ImageEffect.Core 682 683**Since**: 12 684 685**Returns** 686 687Returns the pointer to the **OH_EffectBufferInfo** instance created if the operation is successful; returns a null pointer otherwise. 688 689 690### OH_EffectBufferInfo_GetAddr() 691 692``` 693ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr (OH_EffectBufferInfo * info, void ** addr ) 694``` 695 696**Description** 697 698Obtains the address of an effect buffer. 699 700**System capability**: SystemCapability.Multimedia.ImageEffect.Core 701 702**Since**: 12 703 704**Parameters** 705 706| Name| Description| 707| -------- | -------- | 708| info | Pointer to the image information.| 709| addr | Double pointer to the virtual address of the image buffer.| 710 711**Returns** 712 713Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 714 715 716### OH_EffectBufferInfo_GetEffectFormat() 717 718``` 719ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format * format ) 720``` 721 722**Description** 723 724Obtains the pixel format of an image. 725 726**System capability**: SystemCapability.Multimedia.ImageEffect.Core 727 728**Since**: 12 729 730**Parameters** 731 732| Name| Description| 733| -------- | -------- | 734| info | Pointer to the image information.| 735| format | Pointer to the pixel format, which is [ImageEffect_Format](#imageeffect_format).| 736 737**Returns** 738 739Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 740 741 742### OH_EffectBufferInfo_GetHeight() 743 744``` 745ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight (OH_EffectBufferInfo * info, int32_t * height ) 746``` 747 748**Description** 749 750Obtains the image height. 751 752**System capability**: SystemCapability.Multimedia.ImageEffect.Core 753 754**Since**: 12 755 756**Parameters** 757 758| Name| Description| 759| -------- | -------- | 760| info | Pointer to the image information.| 761| height | Pointer to the image height, in px.| 762 763**Returns** 764 765Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 766 767 768### OH_EffectBufferInfo_GetRowSize() 769 770``` 771ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize (OH_EffectBufferInfo * info, int32_t * rowSize ) 772``` 773 774**Description** 775 776Obtains the number of bytes per row of an image. 777 778**System capability**: SystemCapability.Multimedia.ImageEffect.Core 779 780**Since**: 12 781 782**Parameters** 783 784| Name| Description| 785| -------- | -------- | 786| info | Pointer to the image information.| 787| rowSize | Pointer to the number of bytes per row, in bytes.| 788 789**Returns** 790 791Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 792 793 794### OH_EffectBufferInfo_GetWidth() 795 796``` 797ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth (OH_EffectBufferInfo * info, int32_t * width ) 798``` 799 800**Description** 801 802Obtains the image width. 803 804**System capability**: SystemCapability.Multimedia.ImageEffect.Core 805 806**Since**: 12 807 808**Parameters** 809 810| Name| Description| 811| -------- | -------- | 812| info | Pointer to the image information.| 813| width | Pointer to the image width, in px.| 814 815**Returns** 816 817Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 818 819 820### OH_EffectBufferInfo_Release() 821 822``` 823ImageEffect_ErrorCode OH_EffectBufferInfo_Release (OH_EffectBufferInfo * info) 824``` 825 826**Description** 827 828Destroys an **OH_EffectBufferInfo** instance. 829 830**System capability**: SystemCapability.Multimedia.ImageEffect.Core 831 832**Since**: 12 833 834**Parameters** 835 836| Name| Description| 837| -------- | -------- | 838| info | Pointer to the image information.| 839 840**Returns** 841 842Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 843 844 845### OH_EffectBufferInfo_SetAddr() 846 847``` 848ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr (OH_EffectBufferInfo * info, void * addr ) 849``` 850 851**Description** 852 853Sets the address of an effect buffer. 854 855**System capability**: SystemCapability.Multimedia.ImageEffect.Core 856 857**Since**: 12 858 859**Parameters** 860 861| Name| Description| 862| -------- | -------- | 863| info | Pointer to the image information.| 864| addr | Pointer to the virtual address of the image buffer.| 865 866**Returns** 867 868Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 869 870 871### OH_EffectBufferInfo_SetEffectFormat() 872 873``` 874ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format format ) 875``` 876 877**Description** 878 879Sets the pixel format for an image. 880 881**System capability**: SystemCapability.Multimedia.ImageEffect.Core 882 883**Since**: 12 884 885**Parameters** 886 887| Name| Description| 888| -------- | -------- | 889| info | Pointer to the image information.| 890| format | Pixel format, which is [ImageEffect_Format](#imageeffect_format).| 891 892**Returns** 893 894Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 895 896 897### OH_EffectBufferInfo_SetHeight() 898 899``` 900ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight (OH_EffectBufferInfo * info, int32_t height ) 901``` 902 903**Description** 904 905Sets the image height. 906 907**System capability**: SystemCapability.Multimedia.ImageEffect.Core 908 909**Since**: 12 910 911**Parameters** 912 913| Name| Description| 914| -------- | -------- | 915| info | Pointer to the image information.| 916| height | Image height, in px.| 917 918**Returns** 919 920Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 921 922 923### OH_EffectBufferInfo_SetRowSize() 924 925``` 926ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize (OH_EffectBufferInfo * info, int32_t rowSize ) 927``` 928 929**Description** 930 931Sets the number of bytes per row for an image. 932 933**System capability**: SystemCapability.Multimedia.ImageEffect.Core 934 935**Since**: 12 936 937**Parameters** 938 939| Name| Description| 940| -------- | -------- | 941| info | Pointer to the image information.| 942| rowSize | Number of bytes per row, in bytes.| 943 944**Returns** 945 946Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 947 948 949### OH_EffectBufferInfo_SetWidth() 950 951``` 952ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth (OH_EffectBufferInfo * info, int32_t width ) 953``` 954 955**Description** 956 957Sets the image width. 958 959**System capability**: SystemCapability.Multimedia.ImageEffect.Core 960 961**Since**: 12 962 963**Parameters** 964 965| Name| Description| 966| -------- | -------- | 967| info | Pointer to the image information.| 968| width | Image width, in px.| 969 970**Returns** 971 972Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 973 974 975### OH_EffectFilter_Create() 976 977``` 978OH_EffectFilter* OH_EffectFilter_Create (const char * name) 979``` 980 981**Description** 982 983Creates an **OH_EffectFilter** instance. The instance must be released by calling [OH_EffectFilter_Release](#oh_effectfilter_release) when it is no longer needed. 984 985**System capability**: SystemCapability.Multimedia.ImageEffect.Core 986 987**Since**: 12 988 989**Parameters** 990 991| Name| Description| 992| -------- | -------- | 993| name | Pointer to the filter name, for example, **OH_EFFECT_BRIGHTNESS_FILTER**.| 994 995**Returns** 996 997Returns the pointer to the **OH_EffectFilter** instance created if the operation is successful; returns a null pointer otherwise. 998 999 1000### OH_EffectFilter_GetValue() 1001 1002``` 1003ImageEffect_ErrorCode OH_EffectFilter_GetValue (OH_EffectFilter * filter, const char * key, ImageEffect_Any * value ) 1004``` 1005 1006**Description** 1007 1008Obtains a filter parameter. 1009 1010**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1011 1012**Since**: 12 1013 1014**Parameters** 1015 1016| Name| Description| 1017| -------- | -------- | 1018| filter | Pointer to the filter.| 1019| key | Pointer to the key of the filter parameter, for example, **OH_EFFECT_FILTER_INTENSITY_KEY**.| 1020| value | Pointer to the value of the filter parameter.| 1021 1022**Returns** 1023 1024Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer; returns **EFFECT_KEY_ERROR** if the key of a parameter is invalid. 1025 1026 1027### OH_EffectFilter_LookupFilterInfo() 1028 1029``` 1030ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo (const char * name, OH_EffectFilterInfo * info ) 1031``` 1032 1033**Description** 1034 1035Obtains the filter information. 1036 1037**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1038 1039**Since**: 12 1040 1041**Parameters** 1042 1043| Name| Description| 1044| -------- | -------- | 1045| name | Pointer to the filter name.| 1046| info | Pointer to the filter information, which is [OH_EffectFilterInfo](#oh_effectfilterinfo).| 1047 1048**Returns** 1049 1050Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer or an invalid value. 1051 1052 1053### OH_EffectFilter_LookupFilters() 1054 1055``` 1056ImageEffect_FilterNames* OH_EffectFilter_LookupFilters (const char * key) 1057``` 1058 1059**Description** 1060 1061Obtains filters that meet given conditions. 1062 1063**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1064 1065**Since**: 12 1066 1067**Parameters** 1068 1069| Name| Description| 1070| -------- | -------- | 1071| key | Pointer to the conditions. You can use the keyword **Default** to obtain all filters.| 1072 1073**Returns** 1074 1075Returns a list of filter names, which is [ImageEffect_FilterNames](_image_effect___filter_names.md). 1076 1077 1078### OH_EffectFilter_Register() 1079 1080``` 1081ImageEffect_ErrorCode OH_EffectFilter_Register (const OH_EffectFilterInfo * info, const ImageEffect_FilterDelegate * delegate ) 1082``` 1083 1084**Description** 1085 1086Registers a custom filter. 1087 1088**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1089 1090**Since**: 12 1091 1092**Parameters** 1093 1094| Name| Description| 1095| -------- | -------- | 1096| info | Pointer to the filter information, which is [OH_EffectFilterInfo](#oh_effectfilterinfo).| 1097| delegate | Pointer to the callback function [ImageEffect_FilterDelegate](_image_effect___filter_delegate.md) of the filter.| 1098 1099**Returns** 1100 1101Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1102 1103 1104### OH_EffectFilter_Release() 1105 1106``` 1107ImageEffect_ErrorCode OH_EffectFilter_Release (OH_EffectFilter * filter) 1108``` 1109 1110**Description** 1111 1112Destroys an **OH_EffectFilter** instance. 1113 1114**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1115 1116**Since**: 12 1117 1118**Parameters** 1119 1120| Name| Description| 1121| -------- | -------- | 1122| filter | Pointer to the filter.| 1123 1124**Returns** 1125 1126Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1127 1128 1129### OH_EffectFilter_ReleaseFilterNames() 1130 1131``` 1132void OH_EffectFilter_ReleaseFilterNames () 1133``` 1134 1135**Description** 1136 1137Releases filter name memory resources. 1138 1139**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1140 1141**Since**: 12 1142 1143 1144### OH_EffectFilter_Render() 1145 1146``` 1147ImageEffect_ErrorCode OH_EffectFilter_Render (OH_EffectFilter * filter, OH_PixelmapNative * inputPixelmap, OH_PixelmapNative * outputPixelmap ) 1148``` 1149 1150**Description** 1151 1152Starts image rendering. 1153 1154**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1155 1156**Since**: 12 1157 1158**Parameters** 1159 1160| Name| Description| 1161| -------- | -------- | 1162| filter | Pointer to the filter.| 1163| inputPixelmap | Pointer to the input image.| 1164| outputPixelmap | Pointer to the output image.| 1165 1166**Returns** 1167 1168Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1169 1170 1171### OH_EffectFilter_SetValue() 1172 1173``` 1174ImageEffect_ErrorCode OH_EffectFilter_SetValue (OH_EffectFilter * filter, const char * key, const ImageEffect_Any * value ) 1175``` 1176 1177**Description** 1178 1179Sets a filter parameter. 1180 1181**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1182 1183**Since**: 12 1184 1185**Parameters** 1186 1187| Name| Description| 1188| -------- | -------- | 1189| filter | Pointer to the filter.| 1190| key | Pointer to the key of the filter parameter, for example, **OH_EFFECT_FILTER_INTENSITY_KEY**.| 1191| value | Pointer to the value of the filter parameter.| 1192 1193**Returns** 1194 1195Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer; returns **EFFECT_KEY_ERROR** if the key of a parameter is invalid; returns **EFFECT_PARAM_ERROR** if the value of a parameter is invalid. 1196 1197 1198### OH_EffectFilterInfo_Create() 1199 1200``` 1201OH_EffectFilterInfo* OH_EffectFilterInfo_Create () 1202``` 1203 1204**Description** 1205 1206Creates an **OH_EffectFilterInfo** instance. The instance must be released by calling [OH_EffectFilterInfo_Release](#oh_effectfilterinfo_release) when it is no longer needed. 1207 1208**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1209 1210**Since**: 12 1211 1212**Returns** 1213 1214Returns the pointer to the **OH_EffectFilterInfo** instance created if the operation is successful; returns a null pointer otherwise. 1215 1216 1217### OH_EffectFilterInfo_GetFilterName() 1218 1219``` 1220ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName (OH_EffectFilterInfo * info, char ** name ) 1221``` 1222 1223**Description** 1224 1225Obtains a filter name. 1226 1227**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1228 1229**Since**: 12 1230 1231**Parameters** 1232 1233| Name| Description| 1234| -------- | -------- | 1235| info | Pointer to the filter information.| 1236| name | Double pointer to the char array holding the filter name.| 1237 1238**Returns** 1239 1240Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1241 1242 1243### OH_EffectFilterInfo_GetSupportedBufferTypes() 1244 1245``` 1246ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_BufferType ** bufferTypeArray ) 1247``` 1248 1249**Description** 1250 1251Obtains the buffer types supported by a filter. 1252 1253**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1254 1255**Since**: 12 1256 1257**Parameters** 1258 1259| Name| Description| 1260| -------- | -------- | 1261| info | Pointer to the filter information.| 1262| size | Pointer to the number of buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).| 1263| bufferTypeArray | Double pointer to the array holding the buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).| 1264 1265**Returns** 1266 1267Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1268 1269 1270### OH_EffectFilterInfo_GetSupportedFormats() 1271 1272``` 1273ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_Format ** formatArray ) 1274``` 1275 1276**Description** 1277 1278Obtains the pixel formats supported by a filter. 1279 1280**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1281 1282**Since**: 12 1283 1284**Parameters** 1285 1286| Name| Description| 1287| -------- | -------- | 1288| info | Pointer to the filter information.| 1289| size | Pointer to the number of pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).| 1290| formatArray | Double pointer to the array holding the pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).| 1291 1292**Returns** 1293 1294Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1295 1296 1297### OH_EffectFilterInfo_Release() 1298 1299``` 1300ImageEffect_ErrorCode OH_EffectFilterInfo_Release (OH_EffectFilterInfo * info) 1301``` 1302 1303**Description** 1304 1305Destroys an **OH_EffectFilterInfo** instance. 1306 1307**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1308 1309**Since**: 12 1310 1311**Parameters** 1312 1313| Name| Description| 1314| -------- | -------- | 1315| info | Pointer to the filter information.| 1316 1317**Returns** 1318 1319Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1320 1321 1322### OH_EffectFilterInfo_SetFilterName() 1323 1324``` 1325ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName (OH_EffectFilterInfo * info, const char * name ) 1326``` 1327 1328**Description** 1329 1330Sets a filter name. 1331 1332**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1333 1334**Since**: 12 1335 1336**Parameters** 1337 1338| Name| Description| 1339| -------- | -------- | 1340| info | Pointer to the filter information.| 1341| name | Pointer to the filter name, for example, **OH_EFFECT_BRIGHTNESS_FILTER**.| 1342 1343**Returns** 1344 1345Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1346 1347 1348### OH_EffectFilterInfo_SetSupportedBufferTypes() 1349 1350``` 1351ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_BufferType * bufferTypeArray ) 1352``` 1353 1354**Description** 1355 1356Sets the buffer types supported by a filter. 1357 1358**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1359 1360**Since**: 12 1361 1362**Parameters** 1363 1364| Name| Description| 1365| -------- | -------- | 1366| info | Pointer to the filter information.| 1367| size | Number of buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).| 1368| bufferTypeArray | Pointer to the array holding the buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).| 1369 1370**Returns** 1371 1372Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1373 1374 1375### OH_EffectFilterInfo_SetSupportedFormats() 1376 1377``` 1378ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_Format * formatArray ) 1379``` 1380 1381**Description** 1382 1383Sets the pixel formats supported by a filter. 1384 1385**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1386 1387**Since**: 12 1388 1389**Parameters** 1390 1391| Name| Description| 1392| -------- | -------- | 1393| info | Pointer to the filter information.| 1394| size | Number of pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).| 1395| formatArray | Pointer to the array holding the pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).| 1396 1397**Returns** 1398 1399Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1400 1401 1402### OH_ImageEffect_AddFilter() 1403 1404``` 1405OH_EffectFilter* OH_ImageEffect_AddFilter (OH_ImageEffect * imageEffect, const char * filterName ) 1406``` 1407 1408**Description** 1409 1410Adds a filter. 1411 1412**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1413 1414**Since**: 12 1415 1416**Parameters** 1417 1418| Name| Description| 1419| -------- | -------- | 1420| imageEffect | Pointer to the image effector.| 1421| filterName | Pointer to the filter name.| 1422 1423**Returns** 1424 1425Returns the pointer to the **OH_EffectFilter** instance created if the operation is successful; returns a null pointer if the effector is invalid. 1426 1427 1428### OH_ImageEffect_AddFilterByFilter() 1429 1430``` 1431ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter) 1432``` 1433 1434**Description** 1435 1436Adds a specified filter. 1437 1438**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1439 1440**Since**: 12 1441 1442**Parameters** 1443 1444| Name| Description| 1445| -------- | -------- | 1446| imageEffect | Pointer to the image effector. | 1447| filter | Pointer to the filter. | 1448 1449**Returns** 1450 1451Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1452 1453 1454### OH_ImageEffect_Configure() 1455 1456``` 1457ImageEffect_ErrorCode OH_ImageEffect_Configure (OH_ImageEffect * imageEffect, const char * key, const ImageEffect_Any * value ) 1458``` 1459 1460**Description** 1461 1462Configures an image effector. 1463 1464**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1465 1466**Since**: 12 1467 1468**Parameters** 1469 1470| Name| Description| 1471| -------- | -------- | 1472| imageEffect | Pointer to the image effector.| 1473| key | Pointer to the key of a configuration parameter.| 1474| value | Pointer to the value of a configuration parameter.| 1475 1476**Returns** 1477 1478Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer; returns **EFFECT_KEY_ERROR** if the key of a parameter is invalid; returns **EFFECT_PARAM_ERROR** if the value of a parameter is invalid. 1479 1480 1481### OH_ImageEffect_Create() 1482 1483``` 1484OH_ImageEffect* OH_ImageEffect_Create (const char * name) 1485``` 1486 1487**Description** 1488 1489Creates an **OH_ImageEffect** instance. The instance must be released by calling [OH_ImageEffect_Release](#oh_imageeffect_release) when it is no longer needed. 1490 1491**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1492 1493**Since**: 12 1494 1495**Parameters** 1496 1497| Name| Description| 1498| -------- | -------- | 1499| name | Pointer to the image effector name, which is used to identify the effector and can be customized. You are advised to set it to a non-empty string.| 1500 1501**Returns** 1502 1503Returns the pointer to the **OH_ImageEffect** instance created if the operation is successful; returns a null pointer otherwise. 1504 1505 1506### OH_ImageEffect_GetFilter() 1507 1508``` 1509OH_EffectFilter* OH_ImageEffect_GetFilter (OH_ImageEffect * imageEffect, uint32_t index ) 1510``` 1511 1512**Description** 1513 1514Obtains the information about a filter. 1515 1516**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1517 1518**Since**: 12 1519 1520**Parameters** 1521 1522| Name| Description| 1523| -------- | -------- | 1524| imageEffect | Pointer to the image effector.| 1525| index | Index of the filter.| 1526 1527**Returns** 1528 1529Returns the pointer to the **OH_EffectFilter** instance created if the operation is successful; returns a null pointer if an input parameter is invalid. 1530 1531 1532### OH_ImageEffect_GetFilterCount() 1533 1534``` 1535int32_t OH_ImageEffect_GetFilterCount (OH_ImageEffect * imageEffect) 1536``` 1537 1538**Description** 1539 1540Obtains the number of added filters. 1541 1542**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1543 1544**Since**: 12 1545 1546**Parameters** 1547 1548| Name| Description| 1549| -------- | -------- | 1550| imageEffect | Pointer to the image effector.| 1551 1552**Returns** 1553 1554Returns the number of filters. 1555 1556 1557### OH_ImageEffect_GetInputSurface() 1558 1559``` 1560ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface (OH_ImageEffect * imageEffect, OHNativeWindow ** nativeWindow ) 1561``` 1562 1563**Description** 1564 1565Obtains an input surface. 1566 1567**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1568 1569**Since**: 12 1570 1571**Parameters** 1572 1573| Name| Description| 1574| -------- | -------- | 1575| imageEffect | Pointer to the image effector.| 1576| nativeWindow | Double pointer to the **OHNativeWindow** instance.| 1577 1578**Returns** 1579 1580Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1581 1582 1583### OH_ImageEffect_InsertFilter() 1584 1585``` 1586OH_EffectFilter* OH_ImageEffect_InsertFilter (OH_ImageEffect * imageEffect, uint32_t index, const char * filterName ) 1587``` 1588 1589**Description** 1590 1591Inserts a filter. 1592 1593**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1594 1595**Since**: 12 1596 1597**Parameters** 1598 1599| Name| Description| 1600| -------- | -------- | 1601| imageEffect | Pointer to the image effector.| 1602| index | Index of the filter.| 1603| filterName | Pointer to the filter name.| 1604 1605**Returns** 1606 1607Returns the pointer to the **OH_EffectFilter** instance created if the operation is successful; returns a null pointer if an input parameter is invalid. 1608 1609 1610### OH_ImageEffect_InsertFilterByFilter() 1611 1612``` 1613ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, OH_EffectFilter *filter); 1614``` 1615 1616**Description** 1617 1618Inserts a filter to the specified position. 1619 1620**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1621 1622**Since**: 12 1623 1624**Parameters** 1625 1626| Name| Description| 1627| -------- | -------- | 1628| imageEffect | Pointer to the image effector. | 1629| index | Index of the filter. | 1630| filter | Pointer to the filter. | 1631 1632**Returns** 1633 1634Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1635 1636 1637### OH_ImageEffect_Release() 1638 1639``` 1640ImageEffect_ErrorCode OH_ImageEffect_Release (OH_ImageEffect * imageEffect) 1641``` 1642 1643**Description** 1644 1645Releases an **OH_ImageEffect** instance. 1646 1647**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1648 1649**Since**: 12 1650 1651**Parameters** 1652 1653| Name| Description| 1654| -------- | -------- | 1655| imageEffect | Pointer to the image effector.| 1656 1657**Returns** 1658 1659Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1660 1661 1662### OH_ImageEffect_RemoveFilter() 1663 1664``` 1665int32_t OH_ImageEffect_RemoveFilter (OH_ImageEffect * imageEffect, const char * filterName ) 1666``` 1667 1668**Description** 1669 1670Removes a filter. 1671 1672**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1673 1674**Since**: 12 1675 1676**Parameters** 1677 1678| Name| Description| 1679| -------- | -------- | 1680| imageEffect | Pointer to the image effector.| 1681| filterName | Pointer to the filter name.| 1682 1683**Returns** 1684 1685Returns the number of filters. 1686 1687 1688### OH_ImageEffect_RemoveFilterByIndex() 1689 1690``` 1691ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index) 1692``` 1693 1694**Description** 1695 1696Removes a filter from the specified position. 1697 1698**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1699 1700**Since**: 12 1701 1702**Parameters** 1703 1704| Name| Description| 1705| -------- | -------- | 1706| imageEffect | Pointer to the image effector. | 1707| index | Index of the filter. | 1708 1709**Returns** 1710 1711Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1712 1713 1714### OH_ImageEffect_ReplaceFilter() 1715 1716``` 1717OH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName) 1718``` 1719 1720**Description** 1721 1722Replaces a filter. 1723 1724**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1725 1726**Since**: 12 1727 1728**Parameters** 1729 1730| Name| Description| 1731| -------- | -------- | 1732| imageEffect | Pointer to the image effector. | 1733| filterName | Pointer to the filter name. | 1734 1735**Returns** 1736 1737Returns the pointer to the **OH_EffectFilter** instance created if the operation is successful; returns a null pointer otherwise. 1738 1739 1740### OH_ImageEffect_ReplaceFilterByFilter() 1741 1742``` 1743ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName); 1744``` 1745 1746**Description** 1747 1748Replaces a filter at the specified position. 1749 1750**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1751 1752**Since**: 12 1753 1754**Parameters** 1755 1756| Name| Description| 1757| -------- | -------- | 1758| imageEffect | Pointer to the image effector. | 1759| index | Index of the filter. | 1760| filterName | Pointer to the filter name. | 1761 1762**Returns** 1763 1764Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1765 1766 1767### OH_ImageEffect_Restore() 1768 1769``` 1770OH_ImageEffect* OH_ImageEffect_Restore (const char * info) 1771``` 1772 1773**Description** 1774 1775Deserializes an image effector. 1776 1777**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1778 1779**Since**: 12 1780 1781**Parameters** 1782 1783| Name| Description| 1784| -------- | -------- | 1785| info | Pointer to a serialized JSON string.| 1786 1787**Returns** 1788 1789Returns an **OH_ImageEffect** instance if the deserialization is successful; returns a null pointer otherwise. 1790 1791 1792### OH_ImageEffect_Save() 1793 1794``` 1795ImageEffect_ErrorCode OH_ImageEffect_Save (OH_ImageEffect * imageEffect, char ** info ) 1796``` 1797 1798**Description** 1799 1800Serializes an image effector. 1801 1802**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1803 1804**Since**: 12 1805 1806**Parameters** 1807 1808| Name| Description| 1809| -------- | -------- | 1810| imageEffect | Pointer to the image effector.| 1811| info | Double pointer to a char array holding a serialized JSON string.| 1812 1813**Returns** 1814 1815Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1816 1817 1818### OH_ImageEffect_SetInputNativeBuffer() 1819 1820``` 1821ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer ) 1822``` 1823 1824**Description** 1825 1826Sets an input native buffer. 1827 1828**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1829 1830**Since**: 12 1831 1832**Parameters** 1833 1834| Name| Description| 1835| -------- | -------- | 1836| imageEffect | Pointer to the image effector.| 1837| nativeBuffer | Pointer to the **OH_NativeBuffer** instance.| 1838 1839**Returns** 1840 1841Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1842 1843 1844### OH_ImageEffect_SetInputPicture() 1845 1846``` 1847ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture) 1848``` 1849 1850**Description** 1851 1852Sets an input picture. 1853 1854**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1855 1856**Since**: 13 1857 1858**Parameters** 1859 1860| Name| Description| 1861| -------- | -------- | 1862| imageEffect | Pointer to the image effector. | 1863| picture | Pointer to an **OH_PictureNative** instance. | 1864 1865**Returns** 1866 1867Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1868 1869 1870### OH_ImageEffect_SetInputPixelmap() 1871 1872``` 1873ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap ) 1874``` 1875 1876**Description** 1877 1878Sets an input PixelMap. 1879 1880**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1881 1882**Since**: 12 1883 1884**Parameters** 1885 1886| Name| Description| 1887| -------- | -------- | 1888| imageEffect | Pointer to the image effector.| 1889| pixelmap | Pointer to the **OH_PixelmapNative** instance.| 1890 1891**Returns** 1892 1893Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1894 1895 1896### OH_ImageEffect_SetInputUri() 1897 1898``` 1899ImageEffect_ErrorCode OH_ImageEffect_SetInputUri (OH_ImageEffect * imageEffect, const char * uri ) 1900``` 1901 1902**Description** 1903 1904Sets an input URI. 1905 1906**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1907 1908**Since**: 12 1909 1910**Parameters** 1911 1912| Name| Description| 1913| -------- | -------- | 1914| imageEffect | Pointer to the image effector.| 1915| uri | Pointer to the URI of the image. Only JPEG and HEIF images are supported.| 1916 1917**Returns** 1918 1919Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 1920 1921 1922### OH_ImageEffect_SetOutputNativeBuffer() 1923 1924``` 1925ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer ) 1926``` 1927 1928**Description** 1929 1930Sets an output native buffer. 1931 1932**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1933 1934**Since**: 12 1935 1936**Parameters** 1937 1938| Name| Description| 1939| -------- | -------- | 1940| imageEffect | Pointer to the image effector.| 1941| nativeBuffer | Pointer to an **OH_NativeBuffer** instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input **OH_NativeBuffer** object.| 1942 1943**Returns** 1944 1945Returns **EFFECT_SUCCESS** if the operation is successful. 1946 1947Returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter of the effector is a null pointer. 1948 1949Returns **EFFECT_PARAM_ERROR** if the call fails because of abnormal parameters. 1950 1951 1952### OH_ImageEffect_SetOutputPicture() 1953 1954``` 1955ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture) 1956``` 1957 1958**Description** 1959 1960Sets an output picture. 1961 1962**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1963 1964**Since**: 13 1965 1966**Parameters** 1967 1968| Name| Description| 1969| -------- | -------- | 1970| imageEffect | Pointer to the image effector. | 1971| picture | Pointer to an **OH_PictureNative** instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input **OH_PictureNative** object.| 1972 1973**Returns** 1974 1975Returns **EFFECT_SUCCESS** if the operation is successful. 1976 1977Returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter of the effector is a null pointer. 1978 1979Returns **EFFECT_PARAM_ERROR** if the call fails because of abnormal parameters. 1980 1981 1982### OH_ImageEffect_SetOutputPixelmap() 1983 1984``` 1985ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap ) 1986``` 1987 1988**Description** 1989 1990Sets an output PixelMap. 1991 1992**System capability**: SystemCapability.Multimedia.ImageEffect.Core 1993 1994**Since**: 12 1995 1996**Parameters** 1997 1998| Name| Description| 1999| -------- | -------- | 2000| imageEffect | Pointer to the image effector.| 2001| pixelmap | Pointer to an **OH_PixelmapNative** instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input **OH_PixelmapNative** object.| 2002 2003**Returns** 2004 2005Returns **EFFECT_SUCCESS** if the operation is successful. 2006 2007Returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter of the effector is a null pointer. 2008 2009Returns **EFFECT_PARAM_ERROR** if the call fails because of abnormal parameters. 2010 2011 2012### OH_ImageEffect_SetOutputSurface() 2013 2014``` 2015ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface (OH_ImageEffect * imageEffect, OHNativeWindow * nativeWindow ) 2016``` 2017 2018**Description** 2019 2020Sets an output surface. 2021 2022**System capability**: SystemCapability.Multimedia.ImageEffect.Core 2023 2024**Since**: 12 2025 2026**Parameters** 2027 2028| Name| Description| 2029| -------- | -------- | 2030| imageEffect | Pointer to the image effector.| 2031| nativeWindow | Pointer to the **OHNativeWindow** instance.| 2032 2033**Returns** 2034 2035Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 2036 2037 2038### OH_ImageEffect_SetOutputUri() 2039 2040``` 2041ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri (OH_ImageEffect * imageEffect, const char * uri ) 2042``` 2043 2044**Description** 2045 2046Sets an output URI. 2047 2048**System capability**: SystemCapability.Multimedia.ImageEffect.Core 2049 2050**Since**: 12 2051 2052**Parameters** 2053 2054| Name| Description| 2055| -------- | -------- | 2056| imageEffect | Pointer to the image effector.| 2057| uri | Pointer to the URI of the image. The format of the output URI is the same as that of the input URI. If HEIF encoding is not supported, JPEG encoding is used.| 2058 2059**Returns** 2060 2061Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 2062 2063 2064### OH_ImageEffect_Start() 2065 2066``` 2067ImageEffect_ErrorCode OH_ImageEffect_Start (OH_ImageEffect * imageEffect) 2068``` 2069 2070**Description** 2071 2072Starts an image effector. 2073 2074**System capability**: SystemCapability.Multimedia.ImageEffect.Core 2075 2076**Since**: 12 2077 2078**Parameters** 2079 2080| Name| Description| 2081| -------- | -------- | 2082| imageEffect | Pointer to the image effector.| 2083 2084**Returns** 2085 2086Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer; returns **EFFECT_INPUT_OUTPUT_NOT_SUPPORTED** if the data types of the input and output images to be processed are different; returns **EFFECT_COLOR_SPACE_NOT_MATCH** if the color spaces of the input and output images are different; returns **EFFECT_ALLOCATE_MEMORY_FAILED** if the buffer fails to be allocated. 2087 2088 2089### OH_ImageEffect_Stop() 2090 2091``` 2092ImageEffect_ErrorCode OH_ImageEffect_Stop (OH_ImageEffect * imageEffect) 2093``` 2094 2095**Description** 2096 2097Stops an image effector. 2098 2099**System capability**: SystemCapability.Multimedia.ImageEffect.Core 2100 2101**Since**: 12 2102 2103**Parameters** 2104 2105| Name| Description| 2106| -------- | -------- | 2107| imageEffect | Pointer to the image effector.| 2108 2109**Returns** 2110 2111Returns **EFFECT_SUCCESS** if the operation is successful; returns **EFFECT_ERROR_PARAM_INVALID** if the input parameter is a null pointer. 2112