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