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