• 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 APIs for access to the image interface.
21  *
22  * @since 12
23  */
24 
25 /**
26  * @file image_source_native.h
27  *
28  * @brief Declares APIs for decoding an image source into a pixel map.
29  *
30  * @library libimage_source.so
31  * @syscap SystemCapability.Multimedia.Image.ImageSource
32  * @since 12
33  */
34 
35 #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_SOURCE_NATIVE_H_
36 #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_SOURCE_NATIVE_H_
37 #include "image_common.h"
38 
39 #include "pixelmap_native.h"
40 #include "picture_native.h"
41 #include "raw_file.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Defines an image source object for the image interface.
49  *
50  * @since 12
51  */
52 struct OH_ImageSourceNative;
53 typedef struct OH_ImageSourceNative OH_ImageSourceNative;
54 
55 /**
56  * @brief Defines image source infomation
57  * {@link OH_ImageSourceInfo_Create}.
58  *
59  * @since 12
60  */
61 struct OH_ImageSource_Info;
62 typedef struct OH_ImageSource_Info OH_ImageSource_Info;
63 
64 /**
65  * @brief Defines decoding options for picture
66  * {@link OH_DecodingOptionsForPicture_Create}.
67  *
68  * @since 13
69  */
70 struct OH_DecodingOptionsForPicture;
71 
72 /**
73  * @brief Defines decoding options for picture
74  * {@link OH_DecodingOptionsForPicture_Create}.
75  *
76  * @since 13
77  */
78 typedef struct OH_DecodingOptionsForPicture OH_DecodingOptionsForPicture;
79 
80 /**
81  * @brief Enumerates decoding dynamic range..
82  *
83  * @since 12
84  */
85 typedef enum {
86     /*
87     * Dynamic range depends on the image.
88     */
89     IMAGE_DYNAMIC_RANGE_AUTO = 0,
90     /*
91     * Standard dynamic range.
92     */
93     IMAGE_DYNAMIC_RANGE_SDR = 1,
94     /*
95     * High dynamic range.
96     */
97     IMAGE_DYNAMIC_RANGE_HDR = 2,
98 } IMAGE_DYNAMIC_RANGE;
99 
100 /**
101  * @brief Defines image allocator type for pixelmap
102  *
103  * @since 16
104  */
105 typedef enum {
106     /*
107     * Select allocator Type based on performance.
108     */
109     IMAGE_ALLOCATOR_TYPE_AUTO = 0,
110     /*
111     * DMA type.
112     */
113     IMAGE_ALLOCATOR_TYPE_DMA = 1,
114     /*
115     * Share memory type.
116     */
117     IMAGE_ALLOCATOR_TYPE_SHARE_MEMORY = 2,
118 } IMAGE_ALLOCATOR_TYPE;
119 
120 /**
121  * @brief The strategy for the cropping and scaling operations when both desiredSize and desiredRegion
122  * are specified.
123  *
124  * @since 18
125  */
126 typedef enum {
127     /**
128      * Scale first, then crop.
129      */
130     IMAGE_CROP_AND_SCALE_STRATEGY_SCALE_FIRST = 1,
131 
132     /**
133      * Crop first, then scale.
134      */
135     IMAGE_CROP_AND_SCALE_STRATEGY_CROP_FIRST = 2,
136 } Image_CropAndScaleStrategy;
137 
138 /**
139  * @brief Create a pointer for OH_ImageSource_Info struct.
140  *
141  * @param info The OH_ImageSource_Info pointer will be operated.
142  * @return Returns {@link Image_ErrorCode}
143  * @since 12
144  */
145 Image_ErrorCode OH_ImageSourceInfo_Create(OH_ImageSource_Info **info);
146 
147 /**
148  * @brief Get width number for OH_ImageSource_Info struct.
149  *
150  * @param info The DecodingOptions pointer will be operated.
151  * @param width the number of image width.
152  * @return Returns {@link Image_ErrorCode}
153  * @since 12
154  */
155 Image_ErrorCode OH_ImageSourceInfo_GetWidth(OH_ImageSource_Info *info, uint32_t *width);
156 
157 /**
158  * @brief Get height number for OH_ImageSource_Info struct.
159  *
160  * @param info The DecodingOptions pointer will be operated.
161  * @param height the number of image height.
162  * @return Returns {@link Image_ErrorCode}
163  * @since 12
164  */
165 Image_ErrorCode OH_ImageSourceInfo_GetHeight(OH_ImageSource_Info *info, uint32_t *height);
166 
167 /**
168  * @brief Get isHdr for OH_ImageSource_Info struct.
169  *
170  * @param info The OH_ImageSource_Info pointer will be operated.
171  * @param isHdr Whether the image has a high dynamic range.
172  * @return Returns {@link Image_ErrorCode}
173  * @since 12
174  */
175 Image_ErrorCode OH_ImageSourceInfo_GetDynamicRange(OH_ImageSource_Info *info, bool *isHdr);
176 
177 /**
178  * @brief Get mime type from OH_ImageSource_Info.
179  *
180  * @param info A OH_ImageSource_Info pointer.
181  * @param mimeType Mime type of the Image Source.
182  * @return Returns one of the following result codes:
183  * {@link IMAGE_SUCCESS}: The execution is successful.
184  * {@link IMAGE_SOURCE_INVALID_PARAMETER}: info or mimeType is a null pointer.
185  * @since 20
186  */
187 Image_ErrorCode OH_ImageSourceInfo_GetMimeType(OH_ImageSource_Info *info, Image_MimeType *mimeType);
188 
189 /**
190  * @brief delete OH_ImageSource_Info pointer.
191  *
192  * @param info The OH_ImageSource_Info pointer will be operated.
193  * @return Returns {@link Image_ErrorCode}
194  * @since 12
195  */
196 Image_ErrorCode OH_ImageSourceInfo_Release(OH_ImageSource_Info *info);
197 
198 /**
199  * @brief Defines the options for decoding the image source.
200  * It is used in {@link OH_ImageSourceNative_CreatePixelmap}.
201  *
202  * @since 12
203  */
204 struct OH_DecodingOptions;
205 typedef struct OH_DecodingOptions OH_DecodingOptions;
206 
207 /**
208  * @brief Create a pointer for InitializationOtions struct.
209  *
210  * @param  options The DecodingOptions pointer will be operated.
211  * @return Returns {@link Image_ErrorCode}
212  * @since 12
213  */
214 Image_ErrorCode OH_DecodingOptions_Create(OH_DecodingOptions **options);
215 
216 /**
217  * @brief Get pixelFormat number for DecodingOptions struct.
218  *
219  * @param  options The DecodingOptions pointer will be operated.
220  * @param pixelFormat the number of image pixelFormat.
221  * @return Returns {@link Image_ErrorCode}
222  * @since 12
223  */
224 Image_ErrorCode OH_DecodingOptions_GetPixelFormat(OH_DecodingOptions *options,
225     int32_t *pixelFormat);
226 
227 /**
228  * @brief Set pixelFormat number for DecodingOptions struct.
229  *
230  * @param  options The DecodingOptions pointer will be operated.
231  * @param pixelFormat the number of image pixelFormat.
232  * @return Returns {@link Image_ErrorCode}
233  * @since 12
234  */
235 Image_ErrorCode OH_DecodingOptions_SetPixelFormat(OH_DecodingOptions *options,
236     int32_t pixelFormat);
237 
238 /**
239  * @brief Get strategy number for OH_DecodingOptions struct.
240  *
241  * @param options The OH_DecodingOptions pointer will be operated.
242  * @param cropAndScaleStrategy the number of Scaling and cropping strategy.
243  * @return Returns {@link Image_ErrorCode}
244  * @since 18
245  */
246 Image_ErrorCode OH_DecodingOptions_GetCropAndScaleStrategy(OH_DecodingOptions *options,
247     int32_t *cropAndScaleStrategy);
248 
249 /**
250  * @brief Set strategy number for OH_DecodingOptions struct.
251  *
252  * @param options The OH_DecodingOptions pointer will be operated.
253  * @param cropAndScaleStrategy the number of Scaling and cropping strategy.
254  * @return Returns {@link Image_ErrorCode}
255  * @since 18
256  */
257 Image_ErrorCode OH_DecodingOptions_SetCropAndScaleStrategy(OH_DecodingOptions *options,
258     int32_t cropAndScaleStrategy);
259 
260 /**
261  * @brief Get index number for DecodingOptions struct.
262  *
263  * @param  options The DecodingOptions pointer will be operated.
264  * @param index the number of image index.
265  * @return Returns {@link Image_ErrorCode}
266  * @since 12
267  */
268 Image_ErrorCode OH_DecodingOptions_GetIndex(OH_DecodingOptions *options, uint32_t *index);
269 
270 /**
271  * @brief Set index number for DecodingOptions struct.
272  *
273  * @param  options The DecodingOptions pointer will be operated.
274  * @param index the number of image index.
275  * @return Returns {@link Image_ErrorCode}
276  * @since 12
277  */
278 Image_ErrorCode OH_DecodingOptions_SetIndex(OH_DecodingOptions *options, uint32_t index);
279 
280 /**
281  * @brief Get rotate number for DecodingOptions struct.
282  *
283  * @param  options The DecodingOptions pointer will be operated.
284  * @param rotate the number of image rotate.
285  * @return Returns {@link Image_ErrorCode}
286  * @since 12
287  */
288 Image_ErrorCode OH_DecodingOptions_GetRotate(OH_DecodingOptions *options, float *rotate);
289 
290 /**
291  * @brief Set rotate number for DecodingOptions struct.
292  *
293  * @param  options The DecodingOptions pointer will be operated.
294  * @param rotate the number of image rotate.
295  * @return Returns {@link Image_ErrorCode}
296  * @since 12
297  */
298 Image_ErrorCode OH_DecodingOptions_SetRotate(OH_DecodingOptions *options, float rotate);
299 
300 /**
301  * @brief Get desiredSize number for DecodingOptions struct.
302  *
303  * @param  options The DecodingOptions pointer will be operated.
304  * @param desiredSize the number of image desiredSize.
305  * @return Returns {@link Image_ErrorCode}
306  * @since 12
307  */
308 Image_ErrorCode OH_DecodingOptions_GetDesiredSize(OH_DecodingOptions *options,
309     Image_Size *desiredSize);
310 
311 /**
312  * @brief Set desiredSize number for DecodingOptions struct.
313  *
314  * @param  options The DecodingOptions pointer will be operated.
315  * @param desiredSize the number of image desiredSize.
316  * @return Returns {@link Image_ErrorCode}
317  * @since 12
318  */
319 Image_ErrorCode OH_DecodingOptions_SetDesiredSize(OH_DecodingOptions *options,
320     Image_Size *desiredSize);
321 
322 /**
323  * @brief Set desiredRegion number for DecodingOptions struct.
324  *
325  * @param  options The DecodingOptions pointer will be operated.
326  * @param desiredRegion the number of image desiredRegion.
327  * @return Returns {@link Image_ErrorCode}
328  * @since 12
329  */
330 Image_ErrorCode OH_DecodingOptions_GetDesiredRegion(OH_DecodingOptions *options,
331     Image_Region *desiredRegion);
332 
333 /**
334  * @brief Set desiredRegion number for DecodingOptions struct.
335  *
336  * @param  options The DecodingOptions pointer will be operated.
337  * @param desiredRegion the number of image desiredRegion.
338  * @return Returns {@link Image_ErrorCode}
339  * @since 12
340  */
341 Image_ErrorCode OH_DecodingOptions_SetDesiredRegion(OH_DecodingOptions *options,
342     Image_Region *desiredRegion);
343 
344 /**
345  * @brief Set desiredDynamicRange number for OH_DecodingOptions struct.
346  *
347  * @param options The OH_DecodingOptions pointer will be operated.
348  * @param desiredDynamicRange the number of desired dynamic range {@link IMAGE_DYNAMIC_RANGE}.
349  * @return Returns {@link Image_ErrorCode}
350  * @since 12
351  */
352 Image_ErrorCode OH_DecodingOptions_GetDesiredDynamicRange(OH_DecodingOptions *options,
353     int32_t *desiredDynamicRange);
354 
355 /**
356  * @brief Set desiredDynamicRange number for OH_DecodingOptions struct.
357  *
358  * @param options The OH_DecodingOptions pointer will be operated.
359  * @param desiredDynamicRange the number of desired dynamic range {@link IMAGE_DYNAMIC_RANGE}.
360  * @return Returns {@link Image_ErrorCode}
361  * @since 12
362  */
363 Image_ErrorCode OH_DecodingOptions_SetDesiredDynamicRange(OH_DecodingOptions *options,
364     int32_t desiredDynamicRange);
365 
366 /**
367  * @brief Gets the crop region for the decoding options.
368  *
369  * @param options Pointer to the decoding options.
370  * @param cropRegion The target region will be cropped from the image.
371  * @return Returns one of the following result codes:
372  * {@link IMAGE_SUCCESS} if the execution is successful.
373  * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer.
374  * @since 19
375  */
376 Image_ErrorCode OH_DecodingOptions_GetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion);
377 
378 /**
379  * @brief Sets the crop region for the decoding options.
380  *
381  * @param options Pointer to the decoding options.
382  * @param cropRegion The target region will be cropped from the image.
383  * @return Returns one of the following result codes:
384  * {@link IMAGE_SUCCESS} if the execution is successful.
385  * {@link IMAGE_SOURCE_INVALID_PARAMETER} if options or cropRegion is null pointer.
386  * @since 19
387  */
388 Image_ErrorCode OH_DecodingOptions_SetCropRegion(OH_DecodingOptions *options, Image_Region *cropRegion);
389 
390 /**
391  * @brief Gets desired color space for decoding options.
392  *
393  * @param options Pointer to the decoding options.
394  * @param colorSpace desired color space, {@link ColorSpaceName}.
395  * @return Returns one of the following result codes:
396  * {@link IMAGE_SUCCESS}: The execution is successful.
397  * {@link IMAGE_SOURCE_INVALID_PARAMETER}: options or colorSpace is a null pointer.
398  * @since 20
399  */
400 Image_ErrorCode OH_DecodingOptions_GetDesiredColorSpace(OH_DecodingOptions *options, int32_t *colorSpace);
401 
402 /**
403  * @brief Sets desired color space for decoding options.
404  *
405  * @param options Pointer to the decoding options.
406  * @param colorSpace desired color space, {@link ColorSpaceName}.
407  * @return Returns one of the following result codes:
408  * {@link IMAGE_SUCCESS}: The execution is successful.
409  * {@link IMAGE_SOURCE_INVALID_PARAMETER}: options is a null pointer or colorSpace is not supported.
410  * @since 20
411  */
412 Image_ErrorCode OH_DecodingOptions_SetDesiredColorSpace(OH_DecodingOptions *options, int32_t colorSpace);
413 
414 /**
415  * @brief delete DecodingOptions pointer.
416  *
417  * @param  options The DecodingOptions pointer will be operated.
418  * @return Returns {@link Image_ErrorCode}
419  * @since 12
420  */
421 Image_ErrorCode OH_DecodingOptions_Release(OH_DecodingOptions *options);
422 
423 /**
424  * @brief Creates an ImageSource pointer.
425  *
426  * @param uri Indicates a pointer to the image source URI. Only a file URI or Base64 URI is accepted.
427  * @param uriSize Indicates the length of the image source URI.
428  * @param res Indicates a pointer to the <b>ImageSource</b> object created at the C++ native layer.
429  * @return Returns {@link Image_ErrorCode}
430  * @since 12
431  */
432 Image_ErrorCode OH_ImageSourceNative_CreateFromUri(char *uri, size_t uriSize, OH_ImageSourceNative **res);
433 
434 /**
435  * @brief Creates an void pointer
436  *
437  * @param fd Indicates the image source file descriptor.
438  * @param res Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
439  * @return Returns {@link Image_ErrorCode}
440  * @since 12
441  */
442 Image_ErrorCode OH_ImageSourceNative_CreateFromFd(int32_t fd, OH_ImageSourceNative **res);
443 
444 /**
445  * @brief Creates an void pointer
446  *
447  * @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.
448  * @param dataSize Indicates the size of the image source data.
449  * @param res Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
450  * @return Returns {@link Image_ErrorCode}
451  * @since 12
452  */
453 Image_ErrorCode OH_ImageSourceNative_CreateFromData(uint8_t *data, size_t dataSize, OH_ImageSourceNative **res);
454 
455 /**
456  * @brief Create an image source from data buffer. The data buffer is directly accessed by the image source
457  * object, and therefore the data buffer must remain accessible within the lifecycle of the image source object.
458  *
459  * @param data Pointer to the data buffer.
460  * @param datalength Length of the data buffer.
461  * @param imageSource Double pointer to the image source.
462  * @return Result code.
463  * {@link IMAGE_SUCCESS} if the execution is successful.
464  * {@link IMAGE_SOURCE_INVALID_PARAMETER} if data or imageSource is a null pointer or if datalength is 0.
465  * @since 20
466  */
467 Image_ErrorCode OH_ImageSourceNative_CreateFromDataWithUserBuffer(uint8_t *data, size_t datalength,
468                                                                   OH_ImageSourceNative **imageSource);
469 
470 /**
471  * @brief Creates an void pointer
472  *
473  * @param rawFile Indicates the raw file's file descriptor.
474  * @param res Indicates a void pointer to the <b>ImageSource</b> object created at the C++ native layer.
475  * @return Returns {@link Image_ErrorCode}
476  * @since 12
477  */
478 Image_ErrorCode OH_ImageSourceNative_CreateFromRawFile(RawFileDescriptor *rawFile, OH_ImageSourceNative **res);
479 
480 /**
481  * @brief Decodes an void pointer
482  * based on the specified {@link OH_DecodingOptions} struct.
483  *
484  * @param source Indicates a void pointer(from ImageSource pointer convert).
485  * @param  options Indicates a pointer to the options for decoding the image source.
486  * For details, see {@link OH_DecodingOptions}.
487  * @param resPixMap Indicates a void pointer to the <b>Pixelmap</b> object obtained at the C++ native layer.
488  * @return Returns {@link Image_ErrorCode}
489  * @since 12
490  */
491 Image_ErrorCode OH_ImageSourceNative_CreatePixelmap(OH_ImageSourceNative *source, OH_DecodingOptions *options,
492     OH_PixelmapNative **pixelmap);
493 
494 /**
495  * @brief Decodes an void pointer
496  * based on the specified {@link OH_DecodingOptions} struct, with support for specifying an optional allocator type.
497  *
498  * @param source Indicates a void pointer(from ImageSource pointer convert).
499  * @param options Indicates a pointer to the options for decoding the image source.
500  * For details, see {@link OH_DecodingOptions}.
501  * @param allocator Specifies the allocator type to be used during pixelmap creation.
502  * For details, see {@link IMAGE_ALLOCATOR_TYPE}.
503  * @param pixelmap Indicates a void pointer to the <b>Pixelmap</b> object obtained at the C++ native layer.
504  * @return Returns {@link Image_ErrorCode}
505  * @since 16
506  */
507 Image_ErrorCode OH_ImageSourceNative_CreatePixelmapUsingAllocator(OH_ImageSourceNative *source,
508     OH_DecodingOptions *options, IMAGE_ALLOCATOR_TYPE allocator, OH_PixelmapNative **pixelmap);
509 
510 /**
511  * @brief Decodes an void pointer
512  * the <b>Pixelmap</b> objects at the C++ native layer
513  * based on the specified {@link OH_DecodingOptions} struct.
514  *
515  * @param source Indicates a void pointer(from ImageSource pointer convert).
516  * @param  options Indicates a pointer to the options for decoding the image source.
517  * For details, see {@link OH_DecodingOptions}.
518  * @param resVecPixMap Indicates a pointer array to the <b>Pixelmap</b> objects obtained at the C++ native layer.
519  * It cannot be a null pointer.
520  * @param outSize Indicates a size of resVecPixMap. User can get size from {@link OH_ImageSourceNative_GetFrameCount}.
521  * @return Returns {@link Image_ErrorCode}
522  * @since 12
523  */
524 Image_ErrorCode OH_ImageSourceNative_CreatePixelmapList(OH_ImageSourceNative *source, OH_DecodingOptions *options,
525     OH_PixelmapNative *resVecPixMap[], size_t outSize);
526 
527 /**
528  * @brief Create Picture pointer from ImageSource
529  * based on the specified {@link OH_DecodingOptions} struct.
530  *
531  * @param source Indicates a void pointer(from ImageSource pointer convert).
532  * @param options Indicates a pointer to the options for decoding the image source.
533  * For details, see {@link OH_DecodingOptionsForPicture}.
534  * @param picture Indicates a void pointer to the <b>Picture</b> object obtained at the C++ native layer.
535  * @return Image functions result code.
536  *         {@link IMAGE_SUCCESS} if the execution is successful.
537  *         {@link IMAGE_BAD_PARAMETER} source is nullptr, or picture is nullptr.
538  *         {@link IMAGE_DECODE_FAILED} decode failed.
539  * @since 13
540  */
541 Image_ErrorCode OH_ImageSourceNative_CreatePicture(OH_ImageSourceNative *source, OH_DecodingOptionsForPicture *options,
542     OH_PictureNative **picture);
543 
544 /**
545  * @brief Decodes an image at the specified index into a Picture object.
546  *
547  * @param source Pointer to the image source.
548  * @param index Image index.
549  * @param picture Double pointer to the Picture object obtained after decoding.
550  * @return Returns one of the following result codes:
551  *         {@link IMAGE_SUCCESS} if the execution is successful.
552  *         {@link IMAGE_BAD_SOURCE} if the data source is abnormal.
553  *         {@link IMAGE_SOURCE_UNSUPPORTED_MIME_TYPE} if the image format is unsupported.
554  *         {@link IMAGE_SOURCE_TOO_LARGE} if the image is too large.
555  *         {@link IMAGE_SOURCE_UNSUPPORTED_OPTIONS} if the operation is not supported, for example, invalid index.
556  *         {@link IMAGE_DECODE_FAILED} if decoding failed.
557  * @since 20
558  */
559 Image_ErrorCode OH_ImageSourceNative_CreatePictureAtIndex(OH_ImageSourceNative *source, uint32_t index,
560     OH_PictureNative **picture);
561 
562 /**
563  * @brief Obtains the delay time list from some <b>ImageSource</b> objects (such as GIF image sources).
564  *
565  * @param source Indicates a void pointer(from ImageSource pointer convert).
566  * @param delayTimeList Indicates a pointer to the delay time list obtained. It cannot be a null pointer.
567  * @param size Indicates a size of delayTimeList. User can get size from {@link OH_ImageSourceNative_GetFrameCount}.
568  * @return Returns {@link Image_ErrorCode}
569  * @since 12
570  */
571 Image_ErrorCode OH_ImageSourceNative_GetDelayTimeList(OH_ImageSourceNative *source,
572     int32_t *delayTimeList, size_t size);
573 
574 /**
575  * @brief Obtains image source information from an <b>ImageSource</b> object by index.
576  *
577  * @param source Indicates a void pointer(from ImageSource pointer convert).
578  * @param index Indicates the index of the frame.
579  * @param info Indicates a pointer to the image source information obtained.
580  * For details, see {@link OH_ImageSource_Info}.
581  * @return Returns {@link Image_ErrorCode}
582  * @since 12
583  */
584 Image_ErrorCode OH_ImageSourceNative_GetImageInfo(OH_ImageSourceNative *source, int32_t index,
585     OH_ImageSource_Info *info);
586 
587 /**
588  * @brief Obtains the value of an image property from an <b>ImageSource</b> object.
589  *
590  * @param source Indicates a void pointer(from ImageSource pointer convert).
591  * @param key Indicates a pointer to the property. For details, see {@link Image_String}., key is an exif constant.
592  * Release after use ImageSource, see {@link OH_ImageSourceNative_Release}.
593  * @param value Indicates a pointer to the value obtained.The user can pass in a null pointer and zero size,
594  * we will allocate memory, but user must free memory after use.
595  * @return Returns {@link Image_ErrorCode}
596  * @since 12
597  */
598 Image_ErrorCode OH_ImageSourceNative_GetImageProperty(OH_ImageSourceNative *source, Image_String *key,
599     Image_String *value);
600 
601 /**
602  * @brief Obtains the value of an image property from an <b>ImageSource</b> object.
603  *        The output value.data is null-terminated.
604  *
605  * @param source pointer to ImageSource.
606  * @param key Pointer to the property key.
607  * @param value Pointer to the property value. Output Parameter.
608  * @return Returns One of the following result codes:
609  *         {@link IMAGE_SUCCESS} if the property is retrieved successfully.
610  *         {@link IMAGE_SOURCE_INVALID_PARAMETER} if the source, key or value is nullptr or invalid.
611  * @since 19
612  */
613 Image_ErrorCode OH_ImageSourceNative_GetImagePropertyWithNull(OH_ImageSourceNative *source,
614     Image_String *key, Image_String *value);
615 
616 /**
617  * @brief Modifies the value of an image property of an <b>ImageSource</b> object.
618  * @param source Indicates a void pointer(from ImageSource pointer convert).
619  * @param key Indicates a pointer to the property. For details, see {@link Image_String}., key is an exif constant.
620  * Release after use ImageSource, see {@link OH_ImageSourceNative_Release}.
621  * @param value Indicates a pointer to the new value of the property.
622  * @return Returns {@link Image_ErrorCode}
623  * @since 12
624  */
625 Image_ErrorCode OH_ImageSourceNative_ModifyImageProperty(OH_ImageSourceNative *source, Image_String *key,
626     Image_String *value);
627 
628 /**
629  * @brief Obtains the number of frames from an <b>ImageSource</b> object.
630  *
631  * @param source Indicates a pointer to the {@link OH_ImageSourceNative} object at the C++ native layer.
632  * @param res Indicates a pointer to the number of frames obtained.
633  * @return Returns {@link Image_ErrorCode}
634  * @since 12
635  */
636 Image_ErrorCode OH_ImageSourceNative_GetFrameCount(OH_ImageSourceNative *source, uint32_t *frameCount);
637 
638 /**
639  * @brief Releases an <b>ImageSourc</b> object.
640  *
641  * @param source Indicates a ImageSource pointer.
642  * @return Returns {@link Image_ErrorCode}
643  * @since 12
644  */
645 Image_ErrorCode OH_ImageSourceNative_Release(OH_ImageSourceNative *source);
646 
647 /**
648  * @brief Create a pointer for OH_DecodingOptionsForPicture struct.
649  *
650  * @param options The OH_DecodingOptionsForPicture pointer will be operated.
651  * @return Image functions result code.
652  *         {@link IMAGE_SUCCESS} if the execution is successful.
653  *         {@link IMAGE_BAD_PARAMETER} options is nullptr.
654  * @since 13
655  */
656 Image_ErrorCode OH_DecodingOptionsForPicture_Create(OH_DecodingOptionsForPicture **options);
657 
658 /**
659  * @brief Obtains the desired auxiliary pictures of decoding options.
660  *
661  * @param options The OH_DecodingOptionsForPicture pointer will be operated.
662  * @param desiredAuxiliaryPictures The desired auxiliary pictures in DecodingOptionsForPicture.
663  * @param length The length of desired auxiliary pictures.
664  * @return Image functions result code.
665  *         {@link IMAGE_SUCCESS} if the execution is successful.
666  *         {@link IMAGE_BAD_PARAMETER} options is nullptr, desiredAuxiliaryPictures is nullptr,
667  *         or length is invalid.
668  * @since 13
669  */
670 Image_ErrorCode OH_DecodingOptionsForPicture_GetDesiredAuxiliaryPictures(OH_DecodingOptionsForPicture *options,
671     Image_AuxiliaryPictureType **desiredAuxiliaryPictures, size_t *length);
672 
673 /**
674  * @brief Set decoding options desired auxiliary pictures.
675  *
676  * @param options The OH_DecodingOptionsForPicture pointer will be operated.
677  * @param desiredAuxiliaryPictures The desired auxiliary pictures will be set.
678  * @param length The length of desired auxiliary pictures.
679  * @return Image functions result code.
680  *         {@link IMAGE_SUCCESS} if the execution is successful.
681  *         {@link IMAGE_BAD_PARAMETER} options is nullptr, desiredAuxiliaryPictures is nullptr,
682  *         or length is invalid.
683  * @since 13
684  */
685 Image_ErrorCode OH_DecodingOptionsForPicture_SetDesiredAuxiliaryPictures(OH_DecodingOptionsForPicture *options,
686     Image_AuxiliaryPictureType *desiredAuxiliaryPictures, size_t length);
687 
688 /**
689  * @brief Releases an <b>DecodingOptionsForPicture</b> object.
690  *
691  * @param options Indicates a DecodingOptionsForPicture pointer.
692  * @return Image functions result code.
693  *         {@link IMAGE_SUCCESS} if the execution is successful.
694  *         {@link IMAGE_BAD_PARAMETER} options is nullptr.
695  * @since 13
696  */
697 Image_ErrorCode OH_DecodingOptionsForPicture_Release(OH_DecodingOptionsForPicture *options);
698 
699 /**
700   * @brief Obtains the image formats (MIME types) that can be decoded.
701   *
702   * @param supportedFormat An array of the supported image formats.
703   * @param length Length of supportedFormats.
704   * @return Image functions result code.
705   *         {@link IMAGE_SUCCESS} if the execution is successful.
706   *         {@link IMAGE_SOURCE_BAD_PARAMETER} if supportedFormats or length is nullptr.
707   * @since 20
708  */
709 Image_ErrorCode OH_ImageSourceNative_GetSupportedFormats(Image_MimeType** supportedFormat, size_t* length);
710 
711 #ifdef __cplusplus
712 };
713 #endif
714 /** @} */
715 #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_SOURCE_NATIVE_H