1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup image
18  * @{
19  *
20  * @brief Provides native APIs for image sources.
21  *
22  * @Syscap SystemCapability.Multimedia.Image
23  * @since 10
24  * @version 4.0
25  */
26 
27 /**
28  * @file image_source_mdk.h
29  *
30  * @brief Declares APIs for decoding an image source into a pixel map.
31  *
32  * @Syscap SystemCapability.Multimedia.Image
33  * @since 10
34  * @version 4.0
35  */
36 
37 #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H
38 #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H
39 #include <cstdint>
40 #include "napi/native_api.h"
41 #include "image_mdk_common.h"
42 #include "raw_file.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Defines a native image source object for the image source APIs.
49  *
50  * @Syscap SystemCapability.Multimedia.Image
51  * @since 10
52  * @version 4.0
53  */
54 struct ImageSourceNative_;
55 
56 /**
57  * @brief Defines a native image source object for the image source APIs.
58  *
59  * @Syscap SystemCapability.Multimedia.Image
60  * @since 10
61  * @version 4.0
62  */
63 typedef struct ImageSourceNative_ ImageSourceNative;
64 
65 /**
66  * @brief Defines a pointer to bits per sample, one of the image properties.
67  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
68  *
69  * @Syscap SystemCapability.Multimedia.Image
70  * @since 10
71  * @version 4.0
72  */
73 const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample";
74 
75 /**
76  * @brief Defines a pointer to the orientation, one of the image properties.
77  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
78  *
79  * @Syscap SystemCapability.Multimedia.Image
80  * @since 10
81  * @version 4.0
82  */
83 const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation";
84 
85 /**
86  * @brief Defines a pointer to the image length, one of the image properties.
87  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
88  *
89  * @Syscap SystemCapability.Multimedia.Image
90  * @since 10
91  * @version 4.0
92  */
93 const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength";
94 
95 /**
96  * @brief Defines a pointer to the image width, one of the image properties.
97  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
98  *
99  * @Syscap SystemCapability.Multimedia.Image
100  * @since 10
101  * @version 4.0
102  */
103 const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth";
104 
105 /**
106  * @brief Defines a pointer to the GPS latitude, one of the image properties.
107  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
108  *
109  * @Syscap SystemCapability.Multimedia.Image
110  * @since 10
111  * @version 4.0
112  */
113 const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude";
114 
115 /**
116  * @brief Defines a pointer to the GPS longitude, one of the image properties.
117  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
118  *
119  * @Syscap SystemCapability.Multimedia.Image
120  * @since 10
121  * @version 4.0
122  */
123 const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude";
124 
125 /**
126  * @brief Defines a pointer to the GPS latitude reference information, one of the image properties.
127  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
128  *
129  * @Syscap SystemCapability.Multimedia.Image
130  * @since 10
131  * @version 4.0
132  */
133 const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef";
134 
135 /**
136  * @brief Defines a pointer to the GPS longitude reference information, one of the image properties.
137  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
138  *
139  * @Syscap SystemCapability.Multimedia.Image
140  * @since 10
141  * @version 4.0
142  */
143 const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef";
144 
145 /**
146  * @brief Defines a pointer to the created date and time, one of the image properties.
147  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
148  *
149  * @Syscap SystemCapability.Multimedia.Image
150  * @since 10
151  * @version 4.0
152  */
153 const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal";
154 
155 /**
156  * @brief Defines a pointer to the exposure time, one of the image properties.
157  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
158  *
159  * @Syscap SystemCapability.Multimedia.Image
160  * @since 10
161  * @version 4.0
162  */
163 const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime";
164 
165 /**
166  * @brief Defines a pointer to the scene type, one of the image properties.
167  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
168  *
169  * @Syscap SystemCapability.Multimedia.Image
170  * @since 10
171  * @version 4.0
172  */
173 const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType";
174 
175 /**
176  * @brief Defines a pointer to the ISO speed ratings, one of the image properties.
177  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
178  *
179  * @Syscap SystemCapability.Multimedia.Image
180  * @since 10
181  * @version 4.0
182  */
183 const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings";
184 
185 /**
186  * @brief Defines a pointer to the f-number of the image, one of the image properties.
187  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
188  *
189  * @Syscap SystemCapability.Multimedia.Image
190  * @since 10
191  * @version 4.0
192  */
193 const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber";
194 
195 /**
196  * @brief Defines a pointer to the compressed bits per pixel, one of the image properties.
197  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
198  *
199  * @Syscap SystemCapability.Multimedia.Image
200  * @since 10
201  * @version 4.0
202  */
203 const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel";
204 
205 /**
206  * @brief Defines the region of the image source to decode.
207  * It is used in {@link OhosImageDecodingOps}, {@link OH_ImageSource_CreatePixelMap}, and
208  * {@link OH_ImageSource_CreatePixelMapList}.
209  *
210  * @Syscap SystemCapability.Multimedia.Image
211  * @since 10
212  * @version 4.0
213  */
214 struct OhosImageRegion {
215     /** X coordinate of the start point, in pixels. */
216     int32_t x;
217     /** Y coordinate of the start point, in pixels. */
218     int32_t y;
219     /** Width of the region, in pixels. */
220     int32_t width;
221     /** Height of the region, in pixels. */
222     int32_t height;
223 };
224 
225 /**
226  * @brief Defines image source options infomation
227  * {@link OH_ImageSource_Create} and {@link OH_ImageSource_CreateIncremental}.
228  *
229  * @Syscap SystemCapability.Multimedia.Image
230  * @since 10
231  * @version 4.0
232  */
233 struct OhosImageSourceOps {
234     /** Pixel density of the image source. */
235     int32_t density;
236     /** Image source pixel format, used to describe YUV buffer usually. */
237     int32_t pixelFormat;
238     /** Image source pixel size of width and height. */
239     struct OhosImageSize size;
240 };
241 
242 /**
243  * @brief Defines the options for decoding the image source.
244  * It is used in {@link OH_ImageSource_CreatePixelMap} and {@link OH_ImageSource_CreatePixelMapList}.
245  *
246  * @Syscap SystemCapability.Multimedia.Image
247  * @since 10
248  * @version 4.0
249  */
250 struct OhosImageDecodingOps {
251     /** Defines output pixel map editable. */
252     int8_t editable;
253     /** Defines output pixel format. */
254     int32_t pixelFormat;
255     /** Defines decoding target pixel density. */
256     int32_t fitDensity;
257     /** Defines decoding index of image source. */
258     uint32_t index;
259     /** Defines decoding sample size option. */
260     uint32_t sampleSize;
261     /** Defines decoding rotate option. */
262     uint32_t rotate;
263     /** Defines decoding target pixel size of width and height. */
264     struct OhosImageSize size;
265     /** Defines image source pixel region for decoding. */
266     struct OhosImageRegion region;
267 };
268 
269 /**
270  * @brief Defines the image source information, which is obtained by calling {@link OH_ImageSource_GetImageInfo}.
271  *
272  * @Syscap SystemCapability.Multimedia.Image
273  * @since 10
274  * @version 4.0
275  */
276 struct OhosImageSourceInfo {
277     /** Pixel format of the image source. It is set in {@link OH_ImageSource_Create}. */
278     int32_t pixelFormat;
279     /** Color space of the image source. */
280     int32_t colorSpace;
281     /** Alpha type of the image source. */
282     int32_t alphaType;
283     /** Image density of the image source. It is set in {@link OH_ImageSource_Create}. */
284     int32_t density;
285     /** Pixel width and height of the image source. */
286     struct OhosImageSize size;
287 };
288 
289 /**
290  * @brief Defines the input resource of the image source. It is obtained by calling {@link OH_ImageSource_Create}.
291  * Only one type of resource is accepted at a time.
292  *
293  * @Syscap SystemCapability.Multimedia.Image
294  * @since 10
295  * @version 4.0
296  * @deprecated since 11
297  */
298 struct OhosImageSource {
299     /** Pointer to the image source URI. Only a file URI or Base64 URI is accepted. */
300     char* uri = nullptr;
301     /** Length of the image source URI. */
302     size_t uriSize = 0;
303     /** Descriptor of the image source. */
304     int32_t fd = -1;
305     /** Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted. */
306     uint8_t* buffer = nullptr;
307     /** Size of the image source buffer. */
308     size_t bufferSize = 0;
309 };
310 
311 /**
312  * @brief Defines the delay time list of the image source. It is obtained by calling
313  * {@link OH_ImageSource_GetDelayTime}.
314  *
315  * @Syscap SystemCapability.Multimedia.Image
316  * @since 10
317  * @version 4.0
318  */
319 struct OhosImageSourceDelayTimeList {
320     /** Pointer to the head of the image source delay time list. */
321     int32_t* delayTimeList;
322     /** Size of the image source delay time list. */
323     size_t size = 0;
324 };
325 
326 /**
327  * @brief Defines image source supported format string.
328  * {@link OhosImageSourceSupportedFormatList} and {@link OH_ImageSource_GetSupportedFormats}
329  *
330  * @Syscap SystemCapability.Multimedia.Image
331  * @since 10
332  * @version 4.0
333  */
334 struct OhosImageSourceSupportedFormat {
335     /** Image source supported format string head.*/
336     char* format = nullptr;
337     /** Image source supported format string size.*/
338     size_t size = 0;
339 };
340 
341 /**
342  * @brief Defines the format string list supported by the image source.
343  * It is obtained by calling {@link OH_ImageSource_GetSupportedFormats}.
344  *
345  * @Syscap SystemCapability.Multimedia.Image
346  * @since 10
347  * @version 4.0
348  */
349 struct OhosImageSourceSupportedFormatList {
350     /** Image source supported format string list head.*/
351     struct OhosImageSourceSupportedFormat** supportedFormatList = nullptr;
352     /** Image source supported format string list size.*/
353     size_t size = 0;
354 };
355 
356 /**
357  * @brief Defines the property string (in key-value format) of the image source.
358  * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.
359  *
360  * @Syscap SystemCapability.Multimedia.Image
361  * @since 10
362  * @version 4.0
363  */
364 struct OhosImageSourceProperty {
365     /** Image source property key and value string head.*/
366     char* value = nullptr;
367     /** Image source property key and value string size.*/
368     size_t size = 0;
369 };
370 
371 /**
372  * @brief Defines the update data of the image source. It is obtained by calling {@link OH_ImageSource_UpdateData}.
373  *
374  * @Syscap SystemCapability.Multimedia.Image
375  * @since 10
376  * @version 4.0
377  */
378 struct OhosImageSourceUpdateData {
379     /** Image source update data buffer.*/
380     uint8_t* buffer = nullptr;
381     /** Image source update data buffer size.*/
382     size_t bufferSize = 0;
383     /** Image source offset of update data buffer.*/
384     uint32_t offset = 0;
385     /** Image source update data length in update data buffer.*/
386     uint32_t updateLength = 0;
387     /** Image source update data is completed in this session.*/
388     int8_t isCompleted = 0;
389 };
390 
391 /**
392  * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified
393  * {@link OhosImageSource} and {@link OhosImageSourceOps} structs.
394  *
395  * @param env Indicates a pointer to the Java Native Interface (JNI) environment.
396  * @param src Indicates a pointer to the input resource of the image source. For details, see {@link OhosImageSource}.
397  * @param ops Indicates a pointer to the options for creating the image source.
398  * For details, see {@link OhosImageSourceOps}.
399  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
400  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
401  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
402  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
403  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
404  * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete.
405  * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error.
406  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
407  * returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large.
408  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
409  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
410  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
411  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
412  * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged.
413  * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad.
414  * returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad.
415  * returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed.
416  * returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed.
417  * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed.
418  * @see {@link OhosImageSource}, {@link OhosImageSourceOps}
419  *
420  * @Syscap SystemCapability.Multimedia.Image
421  * @since 10
422  * @version 4.0
423  * @deprecated since 11
424  * @useinstead image#OH_ImageSource_CreateFromUri
425  * @useinstead image#OH_ImageSource_CreateFromFd
426  * @useinstead image#OH_ImageSource_CreateFromData
427  */
428 int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src,
429     struct OhosImageSourceOps* ops, napi_value *res);
430 
431 /**
432  * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified
433  * image source URI and {@link OhosImageSourceOps} structs.
434  *
435  * @param env Indicates a pointer to the Java Native Interface (JNI) environment.
436  * @param uri Indicates a pointer to the image source URI. Only a file URI or Base64 URI is accepted.
437  * @param size Indicates the length of the image source URI.
438  * @param ops Indicates a pointer to the options for creating the image source.
439  * For details, see {@link OhosImageSourceOps}.
440  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
441  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
442  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
443  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
444  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
445  * @see {@link OhosImageSourceOps}
446  *
447  * @Syscap SystemCapability.Multimedia.Image
448  * @since 11
449  * @version 4.1
450  */
451 int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size,
452     struct OhosImageSourceOps* ops, napi_value *res);
453 
454 /**
455  * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified
456  * image source file descriptor and {@link OhosImageSourceOps} structs.
457  *
458  * @param env Indicates a pointer to the Java Native Interface (JNI) environment.
459  * @param fd Indicates the image source file descriptor.
460  * @param ops Indicates a pointer to the options for creating the image source.
461  * For details, see {@link OhosImageSourceOps}.
462  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
463  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
464  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
465  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
466  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
467  * @see {@link OhosImageSourceOps}
468  *
469  * @Syscap SystemCapability.Multimedia.Image
470  * @since 11
471  * @version 4.1
472  */
473 int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd,
474     struct OhosImageSourceOps* ops, napi_value *res);
475 
476 /**
477  * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified
478  * image source data and {@link OhosImageSourceOps} structs.
479  *
480  * @param env Indicates a pointer to the Java Native Interface (JNI) environment.
481  * @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.
482  * @param dataSize Indicates the size of the image source data.
483  * @param ops Indicates a pointer to the options for creating the image source.
484  * For details, see {@link OhosImageSourceOps}.
485  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
486  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
487  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
488  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
489  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
490  * @see {@link OhosImageSourceOps}
491  *
492  * @Syscap SystemCapability.Multimedia.Image
493  * @since 11
494  * @version 4.1
495  */
496 int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSize,
497     struct OhosImageSourceOps* ops, napi_value *res);
498 
499 /**
500  * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified
501  * raw file's file descriptor and {@link OhosImageSourceOps} structs.
502  *
503  * @param env Indicates a pointer to the Java Native Interface (JNI) environment.
504  * @param rawFile Indicates the raw file's file descriptor.
505  * @param ops Indicates a pointer to the options for creating the image source.
506  * For details, see {@link OhosImageSourceOps}.
507  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
508  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
509  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
510  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
511  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
512  * @see {@link OhosImageSourceOps}
513  *
514  * @Syscap SystemCapability.Multimedia.Image
515  * @since 11
516  * @version 4.1
517  */
518 int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile,
519     struct OhosImageSourceOps* ops, napi_value *res);
520 
521 /**
522  * @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified
523  * {@link OhosImageSource} and {@link OhosImageSourceOps} structs.
524  * The image source data will be updated through {@link OH_ImageSource_UpdateData}.
525  *
526  * @param env Indicates a pointer to the JNI environment.
527  * @param src Indicates a pointer to the input resource of the image source. Only the buffer type is accepted.
528  * For details, see {@link OhosImageSource}.
529  * @param ops Indicates a pointer to the options for creating the image source.
530  * For details, see {@link OhosImageSourceOps}.
531  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
532  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
533  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
534  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
535  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
536  * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete.
537  * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error.
538  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
539  * returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large.
540  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
541  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
542  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
543  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
544  * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged.
545  * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad.
546  * returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad.
547  * returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed.
548  * returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed.
549  * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed.
550  * @see {@link OhosImageSource}, {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData}
551  *
552  * @Syscap SystemCapability.Multimedia.Image
553  * @since 10
554  * @version 4.0
555  * @deprecated since 11
556  * @useinstead image#OH_ImageSource_CreateIncrementalFromData
557  */
558 int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* source,
559     struct OhosImageSourceOps* ops, napi_value *res);
560 
561 /**
562  * @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified
563  * image source data and {@link OhosImageSourceOps} structs.
564  * The image source data will be updated through {@link OH_ImageSource_UpdateData}.
565  *
566  * @param env Indicates a pointer to the JNI environment.
567  * @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.
568  * @param dataSize Indicates the size of the image source data.
569  * @param ops Indicates a pointer to the options for creating the image source.
570  * For details, see {@link OhosImageSourceOps}.
571  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.
572  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
573  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
574  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
575  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
576  * @see {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData}
577  *
578  * @Syscap SystemCapability.Multimedia.Image
579  * @since 11
580  * @version 4.1
581  */
582 int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, size_t dataSize,
583     struct OhosImageSourceOps* ops, napi_value *res);
584 
585 /**
586  * @brief Obtains all supported decoding formats.
587  *
588  * @param res Indicates a pointer to the <b>OhosImageSourceSupportedFormatList</b> struct.
589  * When the input <b>supportedFormatList</b> is a null pointer and <b>size</b> is 0, the size of the supported formats
590  * is returned through <b>size</b> in <b>res</b>.
591  * To obtain all formats, a space larger than <b>size</b> is required.
592  * In addition, sufficient space must be reserved for each format supported.
593  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
594  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
595  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
596  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
597  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
598  * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if decode fail.
599  * @see {@link OhosImageSourceSupportedFormatList}, {@link OhosImageSourceSupportedFormat}
600  *
601  * @Syscap SystemCapability.Multimedia.Image
602  * @since 10
603  * @version 4.0
604  */
605 int32_t OH_ImageSource_GetSupportedFormats(struct OhosImageSourceSupportedFormatList* res);
606 
607 /**
608  * @brief Converts an {@link ImageSource} object at the JavaScript native layer to an <b>ImageSourceNative</b> object
609  * at the C++ native layer.
610  *
611  * @param env Indicates a pointer to the JNI environment.
612  * @param source Indicates a pointer to the <b>ImageSource</b> object at the JavaScript native layer.
613  * @return Returns a pointer to the {@link ImageSourceNative} object if the operation is successful;
614  * returns a null pointer otherwise.
615  * @see {@link ImageSourceNative}, {@link OH_ImageSource_Release}
616  *
617  * @Syscap SystemCapability.Multimedia.Image
618  * @since 10
619  * @version 4.0
620  */
621 ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source);
622 
623 /**
624  * @brief Decodes an <b>ImageSource</b> object to obtain a <b>PixelMap</b> object at the JavaScript native layer
625  * based on the specified {@link OhosImageDecodingOps} struct.
626  *
627  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
628  * @param ops Indicates a pointer to the options for decoding the image source.
629  * For details, see {@link OhosImageDecodingOps}.
630  * @param res Indicates a pointer to the <b>PixelMap</b> object obtained at the JavaScript native layer.
631  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
632  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
633  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
634  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
635  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
636  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
637  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
638  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
639  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.
640  * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.
641  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
642  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
643  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.
644  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.
645  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
646  * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.
647  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
648  * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.
649  * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.
650  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
651  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
652  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
653  * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail.
654  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.
655  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.
656  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.
657  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
658  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.
659  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.
660  * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps}
661  *
662  * @Syscap SystemCapability.Multimedia.Image
663  * @since 10
664  * @version 4.0
665  */
666 int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native,
667     struct OhosImageDecodingOps* ops, napi_value *res);
668 
669 /**
670  * @brief Decodes an <b>ImageSource</b> to obtain all the <b>PixelMap</b> objects at the JavaScript native layer
671  * based on the specified {@link OhosImageDecodingOps} struct.
672  *
673  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
674  * @param ops Indicates a pointer to the options for decoding the image source.
675  * For details, see {@link OhosImageDecodingOps}.
676  * @param res Indicates a pointer to the <b>PixelMap</b> objects obtained at the JavaScript native layer.
677  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
678  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
679  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
680  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
681  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
682  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
683  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
684  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
685  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.
686  * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.
687  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
688  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
689  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.
690  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.
691  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
692  * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.
693  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
694  * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.
695  * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.
696  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
697  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
698  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
699  * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail.
700  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.
701  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.
702  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.
703  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
704  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.
705  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.
706  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
707  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
708  * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps}
709  *
710  * @Syscap SystemCapability.Multimedia.Image
711  * @since 10
712  * @version 4.0
713  */
714 int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native,
715     struct OhosImageDecodingOps* ops, napi_value *res);
716 
717 /**
718  * @brief Obtains the delay time list from some <b>ImageSource</b> objects (such as GIF image sources).
719  *
720  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
721  * @param res Indicates a pointer to the delay time list obtained.
722  * For details, see {@link OhosImageSourceDelayTimeList}. When the input <b>delayTimeList</b> is a null pointer and
723  * <b>size</b> is <b>0</b>, the size of the delay time list is returned through <b>size</b> in <b>res</b>.
724  * To obtain the complete delay time list, a space greater than <b>size</b> is required.
725  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
726  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
727  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
728  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
729  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
730  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
731  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
732  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
733  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
734  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
735  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
736  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
737  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
738  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
739  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
740  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
741  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
742  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
743  * @see {@link ImageSourceNative}, {@link OhosImageSourceDelayTimeList}
744  *
745  * @Syscap SystemCapability.Multimedia.Image
746  * @since 10
747  * @version 4.0
748  */
749 int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native,
750     struct OhosImageSourceDelayTimeList* res);
751 
752 /**
753  * @brief Obtains the number of frames from an <b>ImageSource</b> object.
754  *
755  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
756  * @param res Indicates a pointer to the number of frames obtained.
757  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
758  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
759  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
760  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
761  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
762  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
763  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
764  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
765  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
766  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
767  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
768  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
769  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
770  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
771  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
772  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
773  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
774  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
775  * @see {@link ImageSourceNative}
776  *
777  * @Syscap SystemCapability.Multimedia.Image
778  * @since 10
779  * @version 4.0
780  */
781 int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t *res);
782 
783 /**
784  * @brief Obtains image source information from an <b>ImageSource</b> object by index.
785  *
786  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
787  * @param index Indicates the index of the frame.
788  * @param info Indicates a pointer to the image source information obtained.
789  * For details, see {@link OhosImageSourceInfo}.
790  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
791  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
792  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
793  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
794  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
795  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
796  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
797  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
798  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
799  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
800  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
801  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
802  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
803  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
804  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
805  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
806  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
807  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
808  * @see {@link ImageSourceNative}, {@link OhosImageSourceInfo}
809  *
810  * @Syscap SystemCapability.Multimedia.Image
811  * @since 10
812  * @version 4.0
813  */
814 int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t index,
815     struct OhosImageSourceInfo* info);
816 
817 /**
818  * @brief Obtains the value of an image property from an <b>ImageSource</b> object.
819  *
820  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
821  * @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}.
822  * @param value Indicates a pointer to the property value obtained.
823  * If the input <b>value</b> is a null pointer and <b>size</b> is <b>0</b>, the size of the property value is returned
824  * through <b>size</b> in <b>value</b>.
825  * To obtain the complete property value, a space greater than <b>size</b> is required.
826  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
827  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
828  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
829  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
830  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
831  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
832  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
833  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
834  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
835  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
836  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
837  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
838  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
839  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
840  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
841  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
842  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
843  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
844  * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty}
845  *
846  * @Syscap SystemCapability.Multimedia.Image
847  * @since 10
848  * @version 4.0
849  */
850 int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native,
851     struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value);
852 
853 /**
854  * @brief Modifies the value of an image property of an <b>ImageSource</b> object.
855  *
856  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
857  * @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}.
858  * @param value Indicates a pointer to the new value of the property.
859  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
860  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
861  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
862  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
863  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
864  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
865  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
866  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
867  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
868  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
869  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
870  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
871  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
872  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
873  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
874  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
875  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.
876  * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.
877  * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty}
878  *
879  * @Syscap SystemCapability.Multimedia.Image
880  * @since 10
881  * @version 4.0
882  */
883 int32_t OH_ImageSource_ModifyImageProperty(const ImageSourceNative* native,
884     struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value);
885 
886 /**
887  * @brief Updates the data of an <b>ImageSource</b> object.
888  *
889  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
890  * @param data Indicates a pointer to the update data. For details, see {@link OhosImageSourceUpdateData}.
891  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
892  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
893  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
894  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
895  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
896  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.
897  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.
898  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.
899  * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.
900  * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.
901  * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.
902  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
903  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.
904  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.
905  * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.
906  * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.
907  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.
908  * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.
909  * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.
910  * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.
911  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.
912  * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.
913  * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - image add pixel map fail.
914  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.
915  * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.
916  * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.
917  * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.
918  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.
919  * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.
920  * @see {@link ImageSourceNative}, {@link OhosImageSourceUpdateData}
921  *
922  * @Syscap SystemCapability.Multimedia.Image
923  * @since 10
924  * @version 4.0
925  */
926 int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosImageSourceUpdateData* data);
927 
928 
929 /**
930  * @brief Releases an <b>ImageSourceNative</b> object.
931  *
932  * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.
933  * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.
934  * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.
935  * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.
936  * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.
937  * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.
938  * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.
939  * @see {@link ImageSourceNative}, {@link OH_ImageSource_Create}, {@link OH_ImageSource_CreateIncremental}
940  *
941  * @Syscap SystemCapability.Multimedia.Image
942  * @since 10
943  * @version 4.0
944  */
945 int32_t OH_ImageSource_Release(ImageSourceNative* native);
946 #ifdef __cplusplus
947 };
948 #endif
949 #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H
950