• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# image_effect_filter.h
2
3## Overview
4
5The file declares the APIs related to an image effect filter.<br>With these APIs, you can quickly implement basic effect processing or connect multiple filters in series in an image effector to implement complex effect processing. The system provides basic effect processing filters such as brightness and crop filters.
6
7**File to include**: <multimedia/image_effect/image_effect_filter.h>
8
9**Library**: libimage_effect.so
10
11**System capability**: SystemCapability.Multimedia.ImageEffect.Core
12
13**Since**: 12
14
15**Related module**: [ImageEffect](capi-imageeffect.md)
16
17## Summary
18
19### Structs
20
21| Name| typedef Keyword| Description|
22| -- | -- | -- |
23| [ImageEffect_DataValue](capi-imageeffect-imageeffect-datavalue.md) | ImageEffect_DataValue | Describes the data values.|
24| [ImageEffect_Any](capi-imageeffect-imageeffect-any.md) | ImageEffect_Any | Describes the image effect parameters.|
25| [ImageEffect_FilterNames](capi-imageeffect-imageeffect-filternames.md) | ImageEffect_FilterNames | Describes the filter name information.|
26| [ImageEffect_FilterDelegate](capi-imageeffect-imageeffect-filterdelegate.md) | ImageEffect_FilterDelegate | Describes the callback functions of a custom filter.|
27| [ImageEffect_Region](capi-imageeffect-imageeffect-region.md) | ImageEffect_Region | Describes the image region.|
28| [ImageEffect_Size](capi-imageeffect-imageeffect-size.md) | ImageEffect_Size | Describes the image size.|
29| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) | OH_EffectFilter | Describes the image effect filter.|
30| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) | OH_EffectFilterInfo | Describes the filter information.|
31| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) | OH_EffectBufferInfo | Describes the buffer information.|
32
33### Enums
34
35| Name| typedef Keyword| Description|
36| -- | -- | -- |
37| [ImageEffect_DataType](#imageeffect_datatype) | ImageEffect_DataType | Enumerates the data types.|
38| [ImageEffect_Format](#imageeffect_format) | ImageEffect_Format | Enumerates the pixel formats.|
39| [ImageEffect_BufferType](#imageeffect_buffertype) | ImageEffect_BufferType | Enumerates the buffer types.|
40
41### Functions
42
43| Name| typedef Keyword| Description|
44| -- | -- | -- |
45| [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.|
46| [ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName(OH_EffectFilterInfo *info, const char *name)](#oh_effectfilterinfo_setfiltername) | - | Sets a filter name.|
47| [ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName(OH_EffectFilterInfo *info, char **name)](#oh_effectfilterinfo_getfiltername) | - | Obtains a filter name.|
48| [ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes(OH_EffectFilterInfo *info, uint32_t size,ImageEffect_BufferType *bufferTypeArray)](#oh_effectfilterinfo_setsupportedbuffertypes) | - | Sets the buffer types supported by a filter.|
49| [ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes(OH_EffectFilterInfo *info, uint32_t *size,ImageEffect_BufferType **bufferTypeArray)](#oh_effectfilterinfo_getsupportedbuffertypes) | - | Obtains the buffer types supported by a filter.|
50| [ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats(OH_EffectFilterInfo *info, uint32_t size,ImageEffect_Format *formatArray)](#oh_effectfilterinfo_setsupportedformats) | - | Sets the pixel formats supported by a filter.|
51| [ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats(OH_EffectFilterInfo *info, uint32_t *size,ImageEffect_Format **formatArray)](#oh_effectfilterinfo_getsupportedformats) | - | Obtains the pixel formats supported by a filter.|
52| [ImageEffect_ErrorCode OH_EffectFilterInfo_Release(OH_EffectFilterInfo *info)](#oh_effectfilterinfo_release) | - | Destroys an OH_EffectFilterInfo instance.|
53| [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.|
54| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr(OH_EffectBufferInfo *info, void *addr)](#oh_effectbufferinfo_setaddr) | - | Sets the address of an effect buffer.|
55| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr(OH_EffectBufferInfo *info, void **addr)](#oh_effectbufferinfo_getaddr) | - | Obtains the address of an effect buffer.|
56| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth(OH_EffectBufferInfo *info, int32_t width)](#oh_effectbufferinfo_setwidth) | - | Sets the image width.|
57| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth(OH_EffectBufferInfo *info, int32_t *width)](#oh_effectbufferinfo_getwidth) | - | Obtains the image width.|
58| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight(OH_EffectBufferInfo *info, int32_t height)](#oh_effectbufferinfo_setheight) | - | Sets the image height.|
59| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight(OH_EffectBufferInfo *info, int32_t *height)](#oh_effectbufferinfo_getheight) | - | Obtains the image height.|
60| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize(OH_EffectBufferInfo *info, int32_t rowSize)](#oh_effectbufferinfo_setrowsize) | - | Sets the number of bytes per row for an image.|
61| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize(OH_EffectBufferInfo *info, int32_t *rowSize)](#oh_effectbufferinfo_getrowsize) | - | Obtains the number of bytes per row of an image.|
62| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat(OH_EffectBufferInfo *info, ImageEffect_Format format)](#oh_effectbufferinfo_seteffectformat) | - | Sets the pixel format for an image.|
63| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat(OH_EffectBufferInfo *info, ImageEffect_Format *format)](#oh_effectbufferinfo_geteffectformat) | - | Obtains the pixel format of an image.|
64| [ImageEffect_ErrorCode OH_EffectBufferInfo_SetTextureId(OH_EffectBufferInfo *info, int32_t textureId)](#oh_effectbufferinfo_settextureid) | - | Sets the texture ID of the image for an OH_EffectBufferInfo struct.|
65| [ImageEffect_ErrorCode OH_EffectBufferInfo_GetTextureId(OH_EffectBufferInfo *info, int32_t *textureId)](#oh_effectbufferinfo_gettextureid) | - | Obtains the texture ID of an image from an OH_EffectBufferInfo struct.|
66| [ImageEffect_ErrorCode OH_EffectBufferInfo_Release(OH_EffectBufferInfo *info)](#oh_effectbufferinfo_release) | - | Destroys an OH_EffectBufferInfo instance.|
67| [typedef bool (\*OH_EffectFilterDelegate_SetValue)(OH_EffectFilter *filter, const char *key,const ImageEffect_Any *value)](#oh_effectfilterdelegate_setvalue) | OH_EffectFilterDelegate_SetValue | Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.|
68| [typedef void (\*OH_EffectFilterDelegate_PushData)(OH_EffectFilter *filter, OH_EffectBufferInfo *info)](#oh_effectfilterdelegate_pushdata) | OH_EffectFilterDelegate_PushData | Defines 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).|
69| [typedef bool (\*OH_EffectFilterDelegate_Render)(OH_EffectFilter *filter, OH_EffectBufferInfo *info,OH_EffectFilterDelegate_PushData pushData)](#oh_effectfilterdelegate_render) | OH_EffectFilterDelegate_Render | Defines a pointer to the callback function for rendering an image using a custom filter.|
70| [typedef bool (\*OH_EffectFilterDelegate_Save)(OH_EffectFilter *filter, char **info)](#oh_effectfilterdelegate_save) | OH_EffectFilterDelegate_Save | Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.|
71| [typedef OH_EffectFilter *(\*OH_EffectFilterDelegate_Restore)(const char *info)](#oh_effectfilterdelegate_restore) | OH_EffectFilterDelegate_Restore | Defines a pointer to the callback function for deserializing a custom filter.|
72| [OH_EffectFilter *OH_EffectFilter_Create(const char *name)](#oh_effectfilter_create) | - | Creates an OH_EffectFilter instance. The instance must be released by calling [OH_EffectFilter_Release](#oh_effectfilter_release) when it is no longer needed.|
73| [ImageEffect_ErrorCode OH_EffectFilter_SetValue(OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)](#oh_effectfilter_setvalue) | - | Sets a filter parameter.|
74| [ImageEffect_ErrorCode OH_EffectFilter_GetValue(OH_EffectFilter *filter, const char *key, ImageEffect_Any *value)](#oh_effectfilter_getvalue) | - | Obtains a filter parameter.|
75| [ImageEffect_ErrorCode OH_EffectFilter_Register(const OH_EffectFilterInfo *info,const ImageEffect_FilterDelegate *delegate)](#oh_effectfilter_register) | - | Registers a custom filter.|
76| [ImageEffect_FilterNames *OH_EffectFilter_LookupFilters(const char *key)](#oh_effectfilter_lookupfilters) | - | Obtains filters that meet given conditions.|
77| [void OH_EffectFilter_ReleaseFilterNames()](#oh_effectfilter_releasefilternames) | - | Releases filter name memory resources.|
78| [ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo(const char *name, OH_EffectFilterInfo *info)](#oh_effectfilter_lookupfilterinfo) | - | Obtains the filter information.|
79| [ImageEffect_ErrorCode OH_EffectFilter_Render(OH_EffectFilter *filter, OH_PixelmapNative *inputPixelmap,OH_PixelmapNative *outputPixelmap)](#oh_effectfilter_render) | - | Starts image rendering.|
80| [ImageEffect_ErrorCode OH_EffectFilter_RenderWithTextureId(OH_EffectFilter *filter, int32_t inputTextureId,int32_t outputTextureId, int32_t colorSpace)](#oh_effectfilter_renderwithtextureid) | - | Applies the filter effect using texture IDs. This function does not support using the same texture for both input and output.|
81| [ImageEffect_ErrorCode OH_EffectFilter_Release(OH_EffectFilter *filter)](#oh_effectfilter_release) | - | Destroys an OH_EffectFilter instance.|
82
83### Macros
84
85| Name| Description|
86| -- | -- |
87| 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**.<br>**Since**: 12|
88| 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**.<br>**Since**: 12|
89| 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](capi-imageeffect-imageeffect-region.md).<br>**Since**: 12|
90| OH_EFFECT_FILTER_INTENSITY_KEY "FilterIntensity" | Intensity filter.<br>**Since**: 12|
91| OH_EFFECT_FILTER_REGION_KEY "FilterRegion" | Image region filter.<br>**Since**: 12|
92
93## Enum Description
94
95### ImageEffect_DataType
96
97```
98enum ImageEffect_DataType
99```
100
101**Description**
102
103Enumerates the data types.
104
105**System capability**: SystemCapability.Multimedia.ImageEffect.Core
106
107**Since**: 12
108
109| Enum Item| Description|
110| -- | -- |
111| EFFECT_DATA_TYPE_UNKNOWN = 0 | Undefined.|
112| EFFECT_DATA_TYPE_INT32 = 1 | Integer.|
113| EFFECT_DATA_TYPE_FLOAT = 2 | Single-precision floating point.|
114| EFFECT_DATA_TYPE_DOUBLE = 3 | Double-precision floating point.|
115| EFFECT_DATA_TYPE_CHAR = 4 | Byte.|
116| EFFECT_DATA_TYPE_LONG = 5 | Long integer.|
117| EFFECT_DATA_TYPE_BOOL = 6 | Boolean.|
118| EFFECT_DATA_TYPE_PTR = 7 | Pointer.|
119
120### ImageEffect_Format
121
122```
123enum ImageEffect_Format
124```
125
126**Description**
127
128Enumerates the pixel formats.
129
130**System capability**: SystemCapability.Multimedia.ImageEffect.Core
131
132**Since**: 12
133
134| Enum Item| Description|
135| -- | -- |
136| EFFECT_PIXEL_FORMAT_UNKNOWN = 0 | Undefined.|
137| EFFECT_PIXEL_FORMAT_RGBA8888 = 1 | RGBA8888.|
138| EFFECT_PIXEL_FORMAT_NV21 = 2 | NV21.|
139| EFFECT_PIXEL_FORMAT_NV12 = 3 | NV12.|
140| EFFECT_PIXEL_FORMAT_RGBA1010102 = 4 | 10-bit RGBA.|
141| EFFECT_PIXEL_FORMAT_YCBCR_P010 = 5 | 10-bit YCBCR420.|
142| EFFECT_PIXEL_FORMAT_YCRCB_P010 = 6 | 10-bit YCRCB420.|
143
144### ImageEffect_BufferType
145
146```
147enum ImageEffect_BufferType
148```
149
150**Description**
151
152Enumerates the buffer types.
153
154**System capability**: SystemCapability.Multimedia.ImageEffect.Core
155
156**Since**: 12
157
158| Enum Item| Description|
159| -- | -- |
160| EFFECT_BUFFER_TYPE_UNKNOWN = 0 | Undefined.|
161| EFFECT_BUFFER_TYPE_PIXEL = 1 | Pixel image type.|
162| EFFECT_BUFFER_TYPE_TEXTURE = 2 | Texture type.|
163
164
165## Function Description
166
167### OH_EffectFilterInfo_Create()
168
169```
170OH_EffectFilterInfo *OH_EffectFilterInfo_Create()
171```
172
173**Description**
174
175Creates an OH_EffectFilterInfo instance. The instance must be released by calling [OH_EffectFilterInfo_Release](#oh_effectfilterinfo_release) when it is no longer needed.
176
177**System capability**: SystemCapability.Multimedia.ImageEffect.Core
178
179**Since**: 12
180
181**Returns**
182
183| Type| Description|
184| -- | -- |
185| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) * | Pointer to the OH_EffectFilterInfo instance created. If the operation fails, a null pointer is returned.|
186
187### OH_EffectFilterInfo_SetFilterName()
188
189```
190ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName(OH_EffectFilterInfo *info, const char *name)
191```
192
193**Description**
194
195Sets a filter name.
196
197**System capability**: SystemCapability.Multimedia.ImageEffect.Core
198
199**Since**: 12
200
201
202**Parameters**
203
204| Name| Description|
205| -- | -- |
206| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
207| const char *name | Pointer to the filter name, for example, **OH_EFFECT_BRIGHTNESS_FILTER**.|
208
209**Returns**
210
211| Type| Description|
212| -- | -- |
213| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
214
215### OH_EffectFilterInfo_GetFilterName()
216
217```
218ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName(OH_EffectFilterInfo *info, char **name)
219```
220
221**Description**
222
223Obtains a filter name.
224
225**System capability**: SystemCapability.Multimedia.ImageEffect.Core
226
227**Since**: 12
228
229
230**Parameters**
231
232| Name| Description|
233| -- | -- |
234| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
235| char **name | Double pointer to the char array holding the filter name.|
236
237**Returns**
238
239| Type| Description|
240| -- | -- |
241| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
242
243### OH_EffectFilterInfo_SetSupportedBufferTypes()
244
245```
246ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes(OH_EffectFilterInfo *info, uint32_t size,ImageEffect_BufferType *bufferTypeArray)
247```
248
249**Description**
250
251Sets the buffer types supported by a filter.
252
253**System capability**: SystemCapability.Multimedia.ImageEffect.Core
254
255**Since**: 12
256
257
258**Parameters**
259
260| Name| Description|
261| -- | -- |
262| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
263| uint32_t size | Number of buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).|
264| [ImageEffect_BufferType](#imageeffect_buffertype) *bufferTypeArray | Pointer to the array holding the buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).|
265
266**Returns**
267
268| Type| Description|
269| -- | -- |
270| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
271
272### OH_EffectFilterInfo_GetSupportedBufferTypes()
273
274```
275ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes(OH_EffectFilterInfo *info, uint32_t *size,ImageEffect_BufferType **bufferTypeArray)
276```
277
278**Description**
279
280Obtains the buffer types supported by a filter.
281
282**System capability**: SystemCapability.Multimedia.ImageEffect.Core
283
284**Since**: 12
285
286
287**Parameters**
288
289| Name| Description|
290| -- | -- |
291| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
292| uint32_t *size | Number of buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).|
293| [ImageEffect_BufferType](#imageeffect_buffertype) **bufferTypeArray | Double pointer to the array holding the buffer types supported, each of which is [ImageEffect_BufferType](#imageeffect_buffertype).|
294
295**Returns**
296
297| Type| Description|
298| -- | -- |
299| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
300
301### OH_EffectFilterInfo_SetSupportedFormats()
302
303```
304ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats(OH_EffectFilterInfo *info, uint32_t size,ImageEffect_Format *formatArray)
305```
306
307**Description**
308
309Sets the pixel formats supported by a filter.
310
311**System capability**: SystemCapability.Multimedia.ImageEffect.Core
312
313**Since**: 12
314
315
316**Parameters**
317
318| Name| Description|
319| -- | -- |
320| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
321| uint32_t size | Number of pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).|
322| [ImageEffect_Format](#imageeffect_format) *formatArray | Pointer to the array holding the pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).|
323
324**Returns**
325
326| Type| Description|
327| -- | -- |
328| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
329
330### OH_EffectFilterInfo_GetSupportedFormats()
331
332```
333ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats(OH_EffectFilterInfo *info, uint32_t *size,ImageEffect_Format **formatArray)
334```
335
336**Description**
337
338Obtains the pixel formats supported by a filter.
339
340**System capability**: SystemCapability.Multimedia.ImageEffect.Core
341
342**Since**: 12
343
344
345**Parameters**
346
347| Name| Description|
348| -- | -- |
349| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
350| uint32_t *size | Pointer to the number of pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).|
351| [ImageEffect_Format](#imageeffect_format) **formatArray | Double pointer to the array holding the pixel formats supported, each of which is [ImageEffect_Format](#imageeffect_format).|
352
353**Returns**
354
355| Type| Description|
356| -- | -- |
357| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
358
359### OH_EffectFilterInfo_Release()
360
361```
362ImageEffect_ErrorCode OH_EffectFilterInfo_Release(OH_EffectFilterInfo *info)
363```
364
365**Description**
366
367Destroys an OH_EffectFilterInfo instance.
368
369**System capability**: SystemCapability.Multimedia.ImageEffect.Core
370
371**Since**: 12
372
373
374**Parameters**
375
376| Name| Description|
377| -- | -- |
378| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
379
380**Returns**
381
382| Type| Description|
383| -- | -- |
384| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
385
386### OH_EffectBufferInfo_Create()
387
388```
389OH_EffectBufferInfo *OH_EffectBufferInfo_Create()
390```
391
392**Description**
393
394Creates an OH_EffectBufferInfo instance. The instance must be released by calling [OH_EffectBufferInfo_Release](#oh_effectbufferinfo_release) when it is no longer needed.
395
396**System capability**: SystemCapability.Multimedia.ImageEffect.Core
397
398**Since**: 12
399
400**Returns**
401
402| Type| Description|
403| -- | -- |
404| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) * | Pointer to the OH_EffectBufferInfo instance created. If the operation fails, a null pointer is returned.|
405
406### OH_EffectBufferInfo_SetAddr()
407
408```
409ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr(OH_EffectBufferInfo *info, void *addr)
410```
411
412**Description**
413
414Sets the address of an effect buffer.
415
416**System capability**: SystemCapability.Multimedia.ImageEffect.Core
417
418**Since**: 12
419
420
421**Parameters**
422
423| Name| Description|
424| -- | -- |
425| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
426| void *addr | Pointer to the virtual address of the image buffer.|
427
428**Returns**
429
430| Type| Description|
431| -- | -- |
432| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
433
434### OH_EffectBufferInfo_GetAddr()
435
436```
437ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr(OH_EffectBufferInfo *info, void **addr)
438```
439
440**Description**
441
442Obtains the address of an effect buffer.
443
444**System capability**: SystemCapability.Multimedia.ImageEffect.Core
445
446**Since**: 12
447
448
449**Parameters**
450
451| Name| Description|
452| -- | -- |
453| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
454| void **addr | Double pointer to the virtual address of the image buffer.|
455
456**Returns**
457
458| Type| Description|
459| -- | -- |
460| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
461
462### OH_EffectBufferInfo_SetWidth()
463
464```
465ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth(OH_EffectBufferInfo *info, int32_t width)
466```
467
468**Description**
469
470Sets the image width.
471
472**System capability**: SystemCapability.Multimedia.ImageEffect.Core
473
474**Since**: 12
475
476
477**Parameters**
478
479| Name| Description|
480| -- | -- |
481| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
482| int32_t width | Image width, in px.|
483
484**Returns**
485
486| Type| Description|
487| -- | -- |
488| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
489
490### OH_EffectBufferInfo_GetWidth()
491
492```
493ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth(OH_EffectBufferInfo *info, int32_t *width)
494```
495
496**Description**
497
498Obtains the image width.
499
500**System capability**: SystemCapability.Multimedia.ImageEffect.Core
501
502**Since**: 12
503
504
505**Parameters**
506
507| Name| Description|
508| -- | -- |
509| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
510| int32_t *width | Pointer to the image width, in px.|
511
512**Returns**
513
514| Type| Description|
515| -- | -- |
516| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
517
518### OH_EffectBufferInfo_SetHeight()
519
520```
521ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight(OH_EffectBufferInfo *info, int32_t height)
522```
523
524**Description**
525
526Sets the image height.
527
528**System capability**: SystemCapability.Multimedia.ImageEffect.Core
529
530**Since**: 12
531
532
533**Parameters**
534
535| Name| Description|
536| -- | -- |
537| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
538| int32_t height | Image height, in px.|
539
540**Returns**
541
542| Type| Description|
543| -- | -- |
544| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
545
546### OH_EffectBufferInfo_GetHeight()
547
548```
549ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight(OH_EffectBufferInfo *info, int32_t *height)
550```
551
552**Description**
553
554Obtains the image height.
555
556**System capability**: SystemCapability.Multimedia.ImageEffect.Core
557
558**Since**: 12
559
560
561**Parameters**
562
563| Name| Description|
564| -- | -- |
565| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
566| int32_t *height | Pointer to the image height, in px.|
567
568**Returns**
569
570| Type| Description|
571| -- | -- |
572| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
573
574### OH_EffectBufferInfo_SetRowSize()
575
576```
577ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize(OH_EffectBufferInfo *info, int32_t rowSize)
578```
579
580**Description**
581
582Sets the number of bytes per row for an image.
583
584**System capability**: SystemCapability.Multimedia.ImageEffect.Core
585
586**Since**: 12
587
588
589**Parameters**
590
591| Name| Description|
592| -- | -- |
593| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
594| int32_t rowSize | Number of bytes per row, in bytes.|
595
596**Returns**
597
598| Type| Description|
599| -- | -- |
600| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
601
602### OH_EffectBufferInfo_GetRowSize()
603
604```
605ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize(OH_EffectBufferInfo *info, int32_t *rowSize)
606```
607
608**Description**
609
610Obtains the number of bytes per row of an image.
611
612**System capability**: SystemCapability.Multimedia.ImageEffect.Core
613
614**Since**: 12
615
616
617**Parameters**
618
619| Name| Description|
620| -- | -- |
621| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
622| int32_t *rowSize | Pointer to the number of bytes per row, in bytes.|
623
624**Returns**
625
626| Type| Description|
627| -- | -- |
628| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
629
630### OH_EffectBufferInfo_SetEffectFormat()
631
632```
633ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat(OH_EffectBufferInfo *info, ImageEffect_Format format)
634```
635
636**Description**
637
638Sets the pixel format for an image.
639
640**System capability**: SystemCapability.Multimedia.ImageEffect.Core
641
642**Since**: 12
643
644
645**Parameters**
646
647| Name| Description|
648| -- | -- |
649| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
650| [ImageEffect_Format](#imageeffect_format) format | Pixel format.|
651
652**Returns**
653
654| Type| Description|
655| -- | -- |
656| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
657
658### OH_EffectBufferInfo_GetEffectFormat()
659
660```
661ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat(OH_EffectBufferInfo *info, ImageEffect_Format *format)
662```
663
664**Description**
665
666Obtains the pixel format of an image.
667
668**System capability**: SystemCapability.Multimedia.ImageEffect.Core
669
670**Since**: 12
671
672
673**Parameters**
674
675| Name| Description|
676| -- | -- |
677| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
678| [ImageEffect_Format](#imageeffect_format) *format | Pointer to the pixel format.|
679
680**Returns**
681
682| Type| Description|
683| -- | -- |
684| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
685
686### OH_EffectBufferInfo_SetTextureId()
687
688```
689ImageEffect_ErrorCode OH_EffectBufferInfo_SetTextureId(OH_EffectBufferInfo *info, int32_t textureId)
690```
691
692**Description**
693
694Sets the texture ID of the image for an OH_EffectBufferInfo struct.
695
696**System capability**: SystemCapability.Multimedia.ImageEffect.Core
697
698**Since**: 20
699
700
701**Parameters**
702
703| Name| Description|
704| -- | -- |
705| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to an instance of the OH_EffectBufferInfo struct.|
706| int32_t textureId | Texture ID of the image.|
707
708**Returns**
709
710| Type| Description|
711| -- | -- |
712| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is missing.|
713
714### OH_EffectBufferInfo_GetTextureId()
715
716```
717ImageEffect_ErrorCode OH_EffectBufferInfo_GetTextureId(OH_EffectBufferInfo *info, int32_t *textureId)
718```
719
720**Description**
721
722Obtains the texture ID of an image from an OH_EffectBufferInfo struct.
723
724**System capability**: SystemCapability.Multimedia.ImageEffect.Core
725
726**Since**: 20
727
728
729**Parameters**
730
731| Name| Description|
732| -- | -- |
733| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to an instance of the OH_EffectBufferInfo struct.|
734| int32_t *textureId | Pointer to the texture ID of the image.|
735
736**Returns**
737
738| Type| Description|
739| -- | -- |
740| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is missing.|
741
742### OH_EffectBufferInfo_Release()
743
744```
745ImageEffect_ErrorCode OH_EffectBufferInfo_Release(OH_EffectBufferInfo *info)
746```
747
748**Description**
749
750Destroys an OH_EffectBufferInfo instance.
751
752**System capability**: SystemCapability.Multimedia.ImageEffect.Core
753
754**Since**: 12
755
756
757**Parameters**
758
759| Name| Description|
760| -- | -- |
761| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the image information.|
762
763**Returns**
764
765| Type| Description|
766| -- | -- |
767| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
768
769### OH_EffectFilterDelegate_SetValue()
770
771```
772typedef bool (*OH_EffectFilterDelegate_SetValue)(OH_EffectFilter *filter, const char *key,const ImageEffect_Any *value)
773```
774
775**Description**
776
777Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.
778
779**System capability**: SystemCapability.Multimedia.ImageEffect.Core
780
781**Since**: 12
782
783
784**Parameters**
785
786| Name| Description|
787| -- | -- |
788| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
789|  const char *key | Pointer to the key of a filter parameter.|
790| [const ImageEffect_Any](capi-imageeffect-imageeffect-any.md) *value | Pointer to the value of the filter parameter.|
791
792**Returns**
793
794| Type| Description|
795| -- | -- |
796| bool | **true**: The parameter is valid.<br>**false**: The parameter is invalid.|
797
798### OH_EffectFilterDelegate_PushData()
799
800```
801typedef void (*OH_EffectFilterDelegate_PushData)(OH_EffectFilter *filter, OH_EffectBufferInfo *info)
802```
803
804**Description**
805
806Defines 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).
807
808**System capability**: SystemCapability.Multimedia.ImageEffect.Core
809
810**Since**: 12
811
812
813**Parameters**
814
815| Name| Description|
816| -- | -- |
817| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
818|  [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the buffer information, which is **OH_EffectBufferInfo**.|
819
820### OH_EffectFilterDelegate_Render()
821
822```
823typedef bool (*OH_EffectFilterDelegate_Render)(OH_EffectFilter *filter, OH_EffectBufferInfo *info,OH_EffectFilterDelegate_PushData pushData)
824```
825
826**Description**
827
828Defines a pointer to the callback function for rendering an image using a custom filter.
829
830**System capability**: SystemCapability.Multimedia.ImageEffect.Core
831
832**Since**: 12
833
834
835**Parameters**
836
837| Name| Description|
838| -- | -- |
839| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
840| [OH_EffectBufferInfo](capi-imageeffect-oh-effectbufferinfo.md) *info | Pointer to the buffer information, which is **OH_EffectBufferInfo**.|
841| [OH_EffectFilterDelegate_PushData](#oh_effectfilterdelegate_pushdata) pushData | Callback function **OH_EffectFilterDelegate_PushData** used by the custom filter to push image data to the next-level filter.|
842
843**Returns**
844
845| Type| Description|
846| -- | -- |
847| bool | **true**: The operation is successful.<br>**false**: The operation fails.|
848
849### OH_EffectFilterDelegate_Save()
850
851```
852typedef bool (*OH_EffectFilterDelegate_Save)(OH_EffectFilter *filter, char **info)
853```
854
855**Description**
856
857Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.
858
859**System capability**: SystemCapability.Multimedia.ImageEffect.Core
860
861**Since**: 12
862
863
864**Parameters**
865
866| Name| Description|
867| -- | -- |
868| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
869|  char **info | Double pointer to a char array holding a serialized JSON string.|
870
871**Returns**
872
873| Type| Description|
874| -- | -- |
875| bool | **true**: The operation is successful.<br>**false**: The operation fails.|
876
877### OH_EffectFilterDelegate_Restore()
878
879```
880typedef OH_EffectFilter *(*OH_EffectFilterDelegate_Restore)(const char *info)
881```
882
883**Description**
884
885Defines a pointer to the callback function for deserializing a custom filter.
886
887**System capability**: SystemCapability.Multimedia.ImageEffect.Core
888
889**Since**: 12
890
891
892**Parameters**
893
894| Name| Description|
895| -- | -- |
896| const char *info | Pointer to a serialized JSON string.|
897
898**Returns**
899
900| Type| Description|
901| -- | -- |
902| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) | OH_EffectFilter instance. If the operation fails, a null pointer is returned.|
903
904### OH_EffectFilter_Create()
905
906```
907OH_EffectFilter *OH_EffectFilter_Create(const char *name)
908```
909
910**Description**
911
912Creates an OH_EffectFilter instance. The instance must be released by calling [OH_EffectFilter_Release](#oh_effectfilter_release) when it is no longer needed.
913
914**System capability**: SystemCapability.Multimedia.ImageEffect.Core
915
916**Since**: 12
917
918
919**Parameters**
920
921| Name| Description|
922| -- | -- |
923| const char *name | Pointer to the filter name, for example, **OH_EFFECT_BRIGHTNESS_FILTER**.|
924
925**Returns**
926
927| Type| Description|
928| -- | -- |
929| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) * | Pointer to the OH_EffectFilter instance created. If the operation fails, a null pointer is returned.|
930
931### OH_EffectFilter_SetValue()
932
933```
934ImageEffect_ErrorCode OH_EffectFilter_SetValue(OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)
935```
936
937**Description**
938
939Sets a filter parameter.
940
941**System capability**: SystemCapability.Multimedia.ImageEffect.Core
942
943**Since**: 12
944
945
946**Parameters**
947
948| Name| Description|
949| -- | -- |
950| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
951| const char *key | Pointer to the key of the filter parameter, for example, **OH_EFFECT_FILTER_INTENSITY_KEY**.|
952| [const ImageEffect_Any](capi-imageeffect-imageeffect-any.md) *value | Pointer to the value of the filter parameter.|
953
954**Returns**
955
956| Type| Description|
957| -- | -- |
958| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.<br>         **EFFECT_KEY_ERROR**: A parameter is invalid.<br>         **EFFECT_PARAM_ERROR**: A parameter value is invalid.|
959
960### OH_EffectFilter_GetValue()
961
962```
963ImageEffect_ErrorCode OH_EffectFilter_GetValue(OH_EffectFilter *filter, const char *key, ImageEffect_Any *value)
964```
965
966**Description**
967
968Obtains a filter parameter.
969
970**System capability**: SystemCapability.Multimedia.ImageEffect.Core
971
972**Since**: 12
973
974
975**Parameters**
976
977| Name| Description|
978| -- | -- |
979| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
980| const char *key | Pointer to the key of the filter parameter, for example, **OH_EFFECT_FILTER_INTENSITY_KEY**.|
981| [ImageEffect_Any](capi-imageeffect-imageeffect-any.md) *value | Pointer to the value of the filter parameter.|
982
983**Returns**
984
985| Type| Description|
986| -- | -- |
987| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.<br>         **EFFECT_KEY_ERROR**: A parameter is invalid.|
988
989### OH_EffectFilter_Register()
990
991```
992ImageEffect_ErrorCode OH_EffectFilter_Register(const OH_EffectFilterInfo *info,const ImageEffect_FilterDelegate *delegate)
993```
994
995**Description**
996
997Registers a custom filter.
998
999**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1000
1001**Since**: 12
1002
1003
1004**Parameters**
1005
1006| Name| Description|
1007| -- | -- |
1008| [const OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information.|
1009| [const ImageEffect_FilterDelegate](capi-imageeffect-imageeffect-filterdelegate.md) *delegate | Pointer to the callback function **ImageEffect_FilterDelegate** of the filter.|
1010
1011**Returns**
1012
1013| Type| Description|
1014| -- | -- |
1015| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
1016
1017### OH_EffectFilter_LookupFilters()
1018
1019```
1020ImageEffect_FilterNames *OH_EffectFilter_LookupFilters(const char *key)
1021```
1022
1023**Description**
1024
1025Obtains filters that meet given conditions.
1026
1027**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1028
1029**Since**: 12
1030
1031
1032**Parameters**
1033
1034| Name| Description|
1035| -- | -- |
1036| const char *key | Pointer to the conditions. You can use the keyword **Default** to obtain all filters.|
1037
1038**Returns**
1039
1040| Type| Description|
1041| -- | -- |
1042| [ImageEffect_FilterNames](capi-imageeffect-imageeffect-filternames.md) * | Pointer to a list of filter names.|
1043
1044### OH_EffectFilter_ReleaseFilterNames()
1045
1046```
1047void OH_EffectFilter_ReleaseFilterNames()
1048```
1049
1050**Description**
1051
1052Releases filter name memory resources.
1053
1054**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1055
1056**Since**: 12
1057
1058### OH_EffectFilter_LookupFilterInfo()
1059
1060```
1061ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo(const char *name, OH_EffectFilterInfo *info)
1062```
1063
1064**Description**
1065
1066Obtains the filter information.
1067
1068**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1069
1070**Since**: 12
1071
1072
1073**Parameters**
1074
1075| Name| Description|
1076| -- | -- |
1077| const char *name | Pointer to the filter name.|
1078| [OH_EffectFilterInfo](capi-imageeffect-oh-effectfilterinfo.md) *info | Pointer to the filter information, which is **OH_EffectFilterInfo**.|
1079
1080**Returns**
1081
1082| Type| Description|
1083| -- | -- |
1084| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer or an invalid value.|
1085
1086### OH_EffectFilter_Render()
1087
1088```
1089ImageEffect_ErrorCode OH_EffectFilter_Render(OH_EffectFilter *filter, OH_PixelmapNative *inputPixelmap,OH_PixelmapNative *outputPixelmap)
1090```
1091
1092**Description**
1093
1094Starts image rendering.
1095
1096**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1097
1098**Since**: 12
1099
1100
1101**Parameters**
1102
1103| Name| Description|
1104| -- | -- |
1105| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
1106| [OH_PixelmapNative](capi-image-nativemodule-oh-pixelmapnative.md) *inputPixelmap | Pointer to the input image.|
1107| [OH_PixelmapNative](capi-image-nativemodule-oh-pixelmapnative.md) *outputPixelmap | Pointer to the output image.|
1108
1109**Returns**
1110
1111| Type| Description|
1112| -- | -- |
1113| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
1114
1115### OH_EffectFilter_RenderWithTextureId()
1116
1117```
1118ImageEffect_ErrorCode OH_EffectFilter_RenderWithTextureId(OH_EffectFilter *filter, int32_t inputTextureId,int32_t outputTextureId, int32_t colorSpace)
1119```
1120
1121**Description**
1122
1123Applies the filter effect using texture IDs. This function does not support using the same texture for both input and output.
1124
1125**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1126
1127**Since**: 20
1128
1129
1130**Parameters**
1131
1132| Name| Description|
1133| -- | -- |
1134| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to an instance of the OH_EffectFilter struct.|
1135| int32_t inputTextureId | ID of the input texture. This ID must be valid and bound to a texture of the GL_TEXTURE_2D type.|
1136| int32_t outputTextureId | ID of the output texture. This ID must be valid.<br> If it is not bound to a texture, it will automatically be bound to a GL_TEXTURE_2D type.<br> If the texture is already bound and the size is inappropriate, the rendered result may be cropped or partially filled into this texture.|
1137| int32_t colorSpace | Color space of the image.|
1138
1139**Returns**
1140
1141| Type| Description|
1142| -- | -- |
1143| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is missing.|
1144
1145### OH_EffectFilter_Release()
1146
1147```
1148ImageEffect_ErrorCode OH_EffectFilter_Release(OH_EffectFilter *filter)
1149```
1150
1151**Description**
1152
1153Destroys an OH_EffectFilter instance.
1154
1155**System capability**: SystemCapability.Multimedia.ImageEffect.Core
1156
1157**Since**: 12
1158
1159
1160**Parameters**
1161
1162| Name| Description|
1163| -- | -- |
1164| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
1165
1166**Returns**
1167
1168| Type| Description|
1169| -- | -- |
1170| [ImageEffect_ErrorCode](capi-image-effect-errors-h.md#imageeffect_errorcode) | **EFFECT_SUCCESS**: The function is successfully called.<br>         **EFFECT_ERROR_PARAM_INVALID**: A parameter is a null pointer.|
1171