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