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