• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# image_effect.h
2
3## Overview
4
5The **image_effect.h** file declares the APIs related to an image effector.<br> You can use the APIs to add, delete, and query image effect filters. You can connect multiple filters in series to implement complex effect adjustment.<br> The effector supports multiple input types, such as PixelMap, URI, surface, and picture. Different input types are converted into buffer objects in the effector, and effect processing is implemented through the filters.
6
7**File to include**: <multimedia/image_effect/image_effect.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| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) | OH_ImageEffect | Describes the image effector.|
24
25### Functions
26
27| Name| Description|
28| -- | -- |
29| [OH_ImageEffect *OH_ImageEffect_Create(const char *name)](#oh_imageeffect_create) | Creates an OH_ImageEffect instance. The instance must be released by calling [OH_ImageEffect_Release](capi-image-effect-h.md#oh_imageeffect_release) when it is no longer needed.|
30| [OH_EffectFilter *OH_ImageEffect_AddFilter(OH_ImageEffect *imageEffect, const char *filterName)](#oh_imageeffect_addfilter) | Adds a filter.|
31| [ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter)](#oh_imageeffect_addfilterbyfilter) | Adds a specified filter.|
32| [OH_EffectFilter *OH_ImageEffect_InsertFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)](#oh_imageeffect_insertfilter) | Inserts a filter.|
33| [ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index,OH_EffectFilter *filter)](#oh_imageeffect_insertfilterbyfilter) | Inserts a filter to the specified position.|
34| [int32_t OH_ImageEffect_RemoveFilter(OH_ImageEffect *imageEffect, const char *filterName)](#oh_imageeffect_removefilter) | Removes a filter.|
35| [ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index)](#oh_imageeffect_removefilterbyindex) | Removes a filter from the specified position.|
36| [OH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)](#oh_imageeffect_replacefilter) | Replaces a filter.|
37| [ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index,const char *filterName)](#oh_imageeffect_replacefilterbyfilter) | Replaces a filter at the specified position.|
38| [int32_t OH_ImageEffect_GetFilterCount(OH_ImageEffect *imageEffect)](#oh_imageeffect_getfiltercount) | Obtains the number of added filters.|
39| [OH_EffectFilter *OH_ImageEffect_GetFilter(OH_ImageEffect *imageEffect, uint32_t index)](#oh_imageeffect_getfilter) | Obtains the information about a filter.|
40| [ImageEffect_ErrorCode OH_ImageEffect_Configure(OH_ImageEffect *imageEffect, const char *key,const ImageEffect_Any *value)](#oh_imageeffect_configure) | Configures an image effector.|
41| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface(OH_ImageEffect *imageEffect, OHNativeWindow *nativeWindow)](#oh_imageeffect_setoutputsurface) | Sets an output surface.|
42| [ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface(OH_ImageEffect *imageEffect, OHNativeWindow **nativeWindow)](#oh_imageeffect_getinputsurface) | Obtains an input surface.|
43| [ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)](#oh_imageeffect_setinputpixelmap) | Sets an input PixelMap.|
44| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)](#oh_imageeffect_setoutputpixelmap) | Sets an output PixelMap.|
45| [ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)](#oh_imageeffect_setinputnativebuffer) | Sets an input native buffer.|
46| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)](#oh_imageeffect_setoutputnativebuffer) | Sets an output native buffer.|
47| [ImageEffect_ErrorCode OH_ImageEffect_SetInputUri(OH_ImageEffect *imageEffect, const char *uri)](#oh_imageeffect_setinputuri) | Sets an input URI.|
48| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri(OH_ImageEffect *imageEffect, const char *uri)](#oh_imageeffect_setoutputuri) | Sets an output URI.|
49| [ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)](#oh_imageeffect_setinputpicture) | Sets an input picture.|
50| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)](#oh_imageeffect_setoutputpicture) | Sets an output picture.|
51| [ImageEffect_ErrorCode OH_ImageEffect_SetInputTextureId(OH_ImageEffect *imageEffect, int32_t textureId,int32_t colorSpace)](#oh_imageeffect_setinputtextureid) | Sets the ID of the input texture that contains the image information.|
52| [ImageEffect_ErrorCode OH_ImageEffect_SetOutputTextureId(OH_ImageEffect *imageEffect, int32_t textureId)](#oh_imageeffect_setoutputtextureid) | Sets the ID of the output texture that contains the rendered image information.|
53| [ImageEffect_ErrorCode OH_ImageEffect_Start(OH_ImageEffect *imageEffect)](#oh_imageeffect_start) | Starts an image effector.|
54| [ImageEffect_ErrorCode OH_ImageEffect_Stop(OH_ImageEffect *imageEffect)](#oh_imageeffect_stop) | Stops an image effector.|
55| [ImageEffect_ErrorCode OH_ImageEffect_Release(OH_ImageEffect *imageEffect)](#oh_imageeffect_release) | Releases an OH_ImageEffect instance.|
56| [ImageEffect_ErrorCode OH_ImageEffect_Save(OH_ImageEffect *imageEffect, char **info)](#oh_imageeffect_save) | Serializes an image effector.|
57| [OH_ImageEffect *OH_ImageEffect_Restore(const char *info)](#oh_imageeffect_restore) | Deserializes an image effector.|
58
59## Function Description
60
61### OH_ImageEffect_Create()
62
63```
64OH_ImageEffect *OH_ImageEffect_Create(const char *name)
65```
66
67**Description**
68
69Creates an OH_ImageEffect instance. The instance must be released by calling [OH_ImageEffect_Release](capi-image-effect-h.md#oh_imageeffect_release) when it is no longer needed.
70
71**System capability**: SystemCapability.Multimedia.ImageEffect.Core
72
73**Since**: 12
74
75
76**Parameters**
77
78| Name| Description|
79| -- | -- |
80| const char *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.|
81
82**Returns**
83
84| Type| Description|
85| -- | -- |
86| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) * | Pointer to the OH_EffectFilterInfo instance created. If the operation fails, a null pointer is returned.|
87
88### OH_ImageEffect_AddFilter()
89
90```
91OH_EffectFilter *OH_ImageEffect_AddFilter(OH_ImageEffect *imageEffect, const char *filterName)
92```
93
94**Description**
95
96Adds a filter.
97
98**System capability**: SystemCapability.Multimedia.ImageEffect.Core
99
100**Since**: 12
101
102
103**Parameters**
104
105| Name| Description|
106| -- | -- |
107| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
108| const char *filterName | Pointer to the filter name.|
109
110**Returns**
111
112| Type| Description|
113| -- | -- |
114| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) * | Pointer to the OH_EffectFilter instance created. If the effector is invalid, a null pointer is returned.|
115
116### OH_ImageEffect_AddFilterByFilter()
117
118```
119ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter)
120```
121
122**Description**
123
124Adds a specified filter.
125
126**System capability**: SystemCapability.Multimedia.ImageEffect.Core
127
128**Since**: 12
129
130
131**Parameters**
132
133| Name| Description|
134| -- | -- |
135| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
136| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
137
138**Returns**
139
140| Type| Description|
141| -- | -- |
142| [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.|
143
144### OH_ImageEffect_InsertFilter()
145
146```
147OH_EffectFilter *OH_ImageEffect_InsertFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)
148```
149
150**Description**
151
152Inserts a filter.
153
154**System capability**: SystemCapability.Multimedia.ImageEffect.Core
155
156**Since**: 12
157
158
159**Parameters**
160
161| Name| Description|
162| -- | -- |
163| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
164| uint32_t index | Index of the filter.|
165| const char *filterName | Pointer to the filter name.|
166
167**Returns**
168
169| Type| Description|
170| -- | -- |
171| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) * | Pointer to the OH_EffectFilter instance created. If the operation fails, a null pointer is returned.|
172
173### OH_ImageEffect_InsertFilterByFilter()
174
175```
176ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index,OH_EffectFilter *filter)
177```
178
179**Description**
180
181Inserts a filter to the specified position.
182
183**System capability**: SystemCapability.Multimedia.ImageEffect.Core
184
185**Since**: 12
186
187
188**Parameters**
189
190| Name| Description|
191| -- | -- |
192| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
193| uint32_t index | Index of the filter.|
194| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) *filter | Pointer to the filter.|
195
196**Returns**
197
198| Type| Description|
199| -- | -- |
200| [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.|
201
202### OH_ImageEffect_RemoveFilter()
203
204```
205int32_t OH_ImageEffect_RemoveFilter(OH_ImageEffect *imageEffect, const char *filterName)
206```
207
208**Description**
209
210Removes a filter.
211
212**System capability**: SystemCapability.Multimedia.ImageEffect.Core
213
214**Since**: 12
215
216
217**Parameters**
218
219| Name| Description|
220| -- | -- |
221| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
222| const char *filterName | Pointer to the filter name.|
223
224**Returns**
225
226| Type| Description|
227| -- | -- |
228| int32_t | Number of filters.|
229
230### OH_ImageEffect_RemoveFilterByIndex()
231
232```
233ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index)
234```
235
236**Description**
237
238Removes a filter from the specified position.
239
240**System capability**: SystemCapability.Multimedia.ImageEffect.Core
241
242**Since**: 12
243
244
245**Parameters**
246
247| Name| Description|
248| -- | -- |
249| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
250| uint32_t index | Index of the filter.|
251
252**Returns**
253
254| Type| Description|
255| -- | -- |
256| [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.|
257
258### OH_ImageEffect_ReplaceFilter()
259
260```
261OH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)
262```
263
264**Description**
265
266Replaces a filter.
267
268**System capability**: SystemCapability.Multimedia.ImageEffect.Core
269
270**Since**: 12
271
272
273**Parameters**
274
275| Name| Description|
276| -- | -- |
277| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
278| const char *filterName | Pointer to the filter name.|
279
280**Returns**
281
282| Type| Description|
283| -- | -- |
284| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) * | Pointer to the OH_EffectFilter instance created. If the operation fails, a null pointer is returned.|
285
286### OH_ImageEffect_ReplaceFilterByFilter()
287
288```
289ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index,const char *filterName)
290```
291
292**Description**
293
294Replaces a filter at the specified position.
295
296**System capability**: SystemCapability.Multimedia.ImageEffect.Core
297
298**Since**: 12
299
300
301**Parameters**
302
303| Name| Description|
304| -- | -- |
305| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
306| uint32_t index | Index of the filter.|
307| const char *filterName | Pointer to the filter name.|
308
309**Returns**
310
311| Type| Description|
312| -- | -- |
313| [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.|
314
315### OH_ImageEffect_GetFilterCount()
316
317```
318int32_t OH_ImageEffect_GetFilterCount(OH_ImageEffect *imageEffect)
319```
320
321**Description**
322
323Obtains the number of added filters.
324
325**System capability**: SystemCapability.Multimedia.ImageEffect.Core
326
327**Since**: 12
328
329
330**Parameters**
331
332| Name| Description|
333| -- | -- |
334| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
335
336**Returns**
337
338| Type| Description|
339| -- | -- |
340| int32_t | Number of filters.|
341
342### OH_ImageEffect_GetFilter()
343
344```
345OH_EffectFilter *OH_ImageEffect_GetFilter(OH_ImageEffect *imageEffect, uint32_t index)
346```
347
348**Description**
349
350Obtains the information about a filter.
351
352**System capability**: SystemCapability.Multimedia.ImageEffect.Core
353
354**Since**: 12
355
356
357**Parameters**
358
359| Name| Description|
360| -- | -- |
361| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
362| uint32_t index | Index of the filter.|
363
364**Returns**
365
366| Type| Description|
367| -- | -- |
368| [OH_EffectFilter](capi-imageeffect-oh-effectfilter.md) * | Pointer to the OH_EffectFilter instance created. If the operation fails, a null pointer is returned.|
369
370### OH_ImageEffect_Configure()
371
372```
373ImageEffect_ErrorCode OH_ImageEffect_Configure(OH_ImageEffect *imageEffect, const char *key,const ImageEffect_Any *value)
374```
375
376**Description**
377
378Configures an image effector.
379
380**System capability**: SystemCapability.Multimedia.ImageEffect.Core
381
382**Since**: 12
383
384
385**Parameters**
386
387| Name| Description|
388| -- | -- |
389| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
390| const char *key | Pointer to the key of a configuration parameter.|
391| [const ImageEffect_Any](capi-imageeffect-imageeffect-any.md) *value | Pointer to the value of a configuration parameter.|
392
393**Returns**
394
395| Type| Description|
396| -- | -- |
397| [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.|
398
399### OH_ImageEffect_SetOutputSurface()
400
401```
402ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface(OH_ImageEffect *imageEffect, OHNativeWindow *nativeWindow)
403```
404
405**Description**
406
407Sets an output surface.
408
409**System capability**: SystemCapability.Multimedia.ImageEffect.Core
410
411**Since**: 12
412
413
414**Parameters**
415
416| Name| Description|
417| -- | -- |
418| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
419| OHNativeWindow *nativeWindow | Pointer to the OHNativeWindow instance.|
420
421**Returns**
422
423| Type| Description|
424| -- | -- |
425| [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.|
426
427### OH_ImageEffect_GetInputSurface()
428
429```
430ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface(OH_ImageEffect *imageEffect, OHNativeWindow **nativeWindow)
431```
432
433**Description**
434
435Obtains an input surface.
436
437**System capability**: SystemCapability.Multimedia.ImageEffect.Core
438
439**Since**: 12
440
441
442**Parameters**
443
444| Name| Description|
445| -- | -- |
446| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
447| OHNativeWindow **nativeWindow | Double pointer to the OHNativeWindow instance.|
448
449**Returns**
450
451| Type| Description|
452| -- | -- |
453| [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.|
454
455### OH_ImageEffect_SetInputPixelmap()
456
457```
458ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)
459```
460
461**Description**
462
463Sets an input PixelMap.
464
465**System capability**: SystemCapability.Multimedia.ImageEffect.Core
466
467**Since**: 12
468
469
470**Parameters**
471
472| Name| Description|
473| -- | -- |
474| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
475| [OH_PixelmapNative](capi-image-nativemodule-oh-pixelmapnative.md) *pixelmap | Pointer to the OH_PixelmapNative instance.|
476
477**Returns**
478
479| Type| Description|
480| -- | -- |
481| [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.|
482
483### OH_ImageEffect_SetOutputPixelmap()
484
485```
486ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap(OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)
487```
488
489**Description**
490
491Sets an output PixelMap.
492
493**System capability**: SystemCapability.Multimedia.ImageEffect.Core
494
495**Since**: 12
496
497
498**Parameters**
499
500| Name| Description|
501| -- | -- |
502| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
503| [OH_PixelmapNative](capi-image-nativemodule-oh-pixelmapnative.md) *pixelmap | Pointer to the OH_PixelmapNative instance.|
504
505**Returns**
506
507| Type| Description|
508| -- | -- |
509| [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_PARAM_ERROR**: The call fails because of abnormal parameters.|
510
511### OH_ImageEffect_SetInputNativeBuffer()
512
513```
514ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)
515```
516
517**Description**
518
519Sets an input native buffer.
520
521**System capability**: SystemCapability.Multimedia.ImageEffect.Core
522
523**Since**: 12
524
525
526**Parameters**
527
528| Name| Description|
529| -- | -- |
530| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
531| [OH_NativeBuffer](../apis-arkgraphics2d/capi-oh-nativebuffer-oh-nativebuffer.md) *nativeBuffer | Pointer to the OH_NativeBuffer instance.|
532
533**Returns**
534
535| Type| Description|
536| -- | -- |
537| [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.|
538
539### OH_ImageEffect_SetOutputNativeBuffer()
540
541```
542ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer(OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)
543```
544
545**Description**
546
547Sets an output native buffer.
548
549**System capability**: SystemCapability.Multimedia.ImageEffect.Core
550
551**Since**: 12
552
553
554**Parameters**
555
556| Name| Description|
557| -- | -- |
558| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
559| [OH_NativeBuffer](../apis-arkgraphics2d/capi-oh-nativebuffer-oh-nativebuffer.md) *nativeBuffer | Pointer to an OH_NativeBuffer instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_NativeBuffer object.|
560
561**Returns**
562
563| Type| Description|
564| -- | -- |
565| [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_PARAM_ERROR**: The call fails because of abnormal parameters.|
566
567### OH_ImageEffect_SetInputUri()
568
569```
570ImageEffect_ErrorCode OH_ImageEffect_SetInputUri(OH_ImageEffect *imageEffect, const char *uri)
571```
572
573**Description**
574
575Sets an input URI.
576
577**System capability**: SystemCapability.Multimedia.ImageEffect.Core
578
579**Since**: 12
580
581
582**Parameters**
583
584| Name| Description|
585| -- | -- |
586| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
587| const char *uri | Pointer to the URI of the image. Only JPEG and HEIF images are supported.|
588
589**Returns**
590
591| Type| Description|
592| -- | -- |
593| [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.|
594
595### OH_ImageEffect_SetOutputUri()
596
597```
598ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri(OH_ImageEffect *imageEffect, const char *uri)
599```
600
601**Description**
602
603Sets an output URI.
604
605**System capability**: SystemCapability.Multimedia.ImageEffect.Core
606
607**Since**: 12
608
609
610**Parameters**
611
612| Name| Description|
613| -- | -- |
614| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
615| const char *uri | Pointer to the URI of the image. The format of the output URI is the same as that of the input URI. If HEIF encoding is not supported, JPEG encoding is used.|
616
617**Returns**
618
619| Type| Description|
620| -- | -- |
621| [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.|
622
623### OH_ImageEffect_SetInputPicture()
624
625```
626ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)
627```
628
629**Description**
630
631Sets an input picture.
632
633**System capability**: SystemCapability.Multimedia.ImageEffect.Core
634
635**Since**: 13
636
637
638**Parameters**
639
640| Name| Description|
641| -- | -- |
642| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
643| [OH_PictureNative](capi-image-nativemodule-oh-picturenative.md) *picture | Pointer to an OH_PictureNative instance.|
644
645**Returns**
646
647| Type| Description|
648| -- | -- |
649| [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.|
650
651### OH_ImageEffect_SetOutputPicture()
652
653```
654ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)
655```
656
657**Description**
658
659Sets an output picture.
660
661**System capability**: SystemCapability.Multimedia.ImageEffect.Core
662
663**Since**: 13
664
665
666**Parameters**
667
668| Name| Description|
669| -- | -- |
670| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
671| [OH_PictureNative](capi-image-nativemodule-oh-picturenative.md) *picture | Pointer to an OH_PictureNative instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_PictureNative object.|
672
673**Returns**
674
675| Type| Description|
676| -- | -- |
677| [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_PARAM_ERROR**: The call fails because of abnormal parameters.|
678
679### OH_ImageEffect_SetInputTextureId()
680
681```
682ImageEffect_ErrorCode OH_ImageEffect_SetInputTextureId(OH_ImageEffect *imageEffect, int32_t textureId,int32_t colorSpace)
683```
684
685**Description**
686
687Sets the ID of the input texture that contains the image information.
688
689**System capability**: SystemCapability.Multimedia.ImageEffect.Core
690
691**Since**: 20
692
693
694**Parameters**
695
696| Name| Description|
697| -- | -- |
698| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to an instance of the OH_ImageEffect struct.|
699| int32_t textureId | ID of the texture that contains the image information. This ID must be valid and have been bound to a texture of a GL_TEXTURE_2D type.|
700| int32_t colorSpace | Color space of the image.|
701
702**Returns**
703
704| Type| Description|
705| -- | -- |
706| [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 a parameter value is out of range.<br>         **EFFECT_PARAM_ERROR**: A parameter is missing or incorrect.|
707
708### OH_ImageEffect_SetOutputTextureId()
709
710```
711ImageEffect_ErrorCode OH_ImageEffect_SetOutputTextureId(OH_ImageEffect *imageEffect, int32_t textureId)
712```
713
714**Description**
715
716Sets the ID of the output texture that contains the rendered image information.
717
718**System capability**: SystemCapability.Multimedia.ImageEffect.Core
719
720**Since**: 20
721
722
723**Parameters**
724
725| Name| Description|
726| -- | -- |
727| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to an instance of the OH_ImageEffect struct.|
728| int32_t textureId | ID of the texture that contains the rendered image information. 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.|
729
730**Returns**
731
732| Type| Description|
733| -- | -- |
734| [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 a parameter value is out of range.<br>         **EFFECT_PARAM_ERROR**: A parameter is missing or incorrect.|
735
736### OH_ImageEffect_Start()
737
738```
739ImageEffect_ErrorCode OH_ImageEffect_Start(OH_ImageEffect *imageEffect)
740```
741
742**Description**
743
744Starts an image effector.
745
746**System capability**: SystemCapability.Multimedia.ImageEffect.Core
747
748**Since**: 12
749
750
751**Parameters**
752
753| Name| Description|
754| -- | -- |
755| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
756
757**Returns**
758
759| Type| Description|
760| -- | -- |
761| [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_INPUT_OUTPUT_NOT_SUPPORTED**: The data types of the input and output images to be processed are different.<br>         **EFFECT_COLOR_SPACE_NOT_MATCH**: The color spaces of the input and output images are different.<br>         **EFFECT_ALLOCATE_MEMORY_FAILED**: Memory allocation fails.|
762
763### OH_ImageEffect_Stop()
764
765```
766ImageEffect_ErrorCode OH_ImageEffect_Stop(OH_ImageEffect *imageEffect)
767```
768
769**Description**
770
771Stops an image effector.
772
773**System capability**: SystemCapability.Multimedia.ImageEffect.Core
774
775**Since**: 12
776
777
778**Parameters**
779
780| Name| Description|
781| -- | -- |
782| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
783
784**Returns**
785
786| Type| Description|
787| -- | -- |
788| [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.|
789
790### OH_ImageEffect_Release()
791
792```
793ImageEffect_ErrorCode OH_ImageEffect_Release(OH_ImageEffect *imageEffect)
794```
795
796**Description**
797
798Releases an OH_ImageEffect instance.
799
800**System capability**: SystemCapability.Multimedia.ImageEffect.Core
801
802**Since**: 12
803
804
805**Parameters**
806
807| Name| Description|
808| -- | -- |
809| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
810
811**Returns**
812
813| Type| Description|
814| -- | -- |
815| [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.|
816
817### OH_ImageEffect_Save()
818
819```
820ImageEffect_ErrorCode OH_ImageEffect_Save(OH_ImageEffect *imageEffect, char **info)
821```
822
823**Description**
824
825Serializes an image effector.
826
827**System capability**: SystemCapability.Multimedia.ImageEffect.Core
828
829**Since**: 12
830
831
832**Parameters**
833
834| Name| Description|
835| -- | -- |
836| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) *imageEffect | Pointer to the image effector.|
837| char **info | Double pointer to a char array holding a serialized JSON string.|
838
839**Returns**
840
841| Type| Description|
842| -- | -- |
843| [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.|
844
845### OH_ImageEffect_Restore()
846
847```
848OH_ImageEffect *OH_ImageEffect_Restore(const char *info)
849```
850
851**Description**
852
853Deserializes an image effector.
854
855**System capability**: SystemCapability.Multimedia.ImageEffect.Core
856
857**Since**: 12
858
859
860**Parameters**
861
862| Name| Description|
863| -- | -- |
864| const char *info | Pointer to a serialized JSON string.|
865
866**Returns**
867
868| Type| Description|
869| -- | -- |
870| [OH_ImageEffect](capi-imageeffect-oh-imageeffect.md) * | OH_ImageEffect instance. If the deserialization fails, a null pointer is returned.|
871<!--no_check-->