1e41f4b71Sopenharmony_ci# image_source_native.h
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciThe **image_source_native.h** file declares the APIs for image decoding.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Library**: libimage_source.so
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Image.ImageSource
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**Since**: 12
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Related module**: [Image_NativeModule](_image___native_module.md)
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## Summary
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci### Types
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci| Name| Description| 
23e41f4b71Sopenharmony_ci| -------- | -------- |
24e41f4b71Sopenharmony_ci| typedef struct [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) | Defines the **ImageSource** struct, which is used to perform operations related to an image source.| 
25e41f4b71Sopenharmony_ci| typedef struct [OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) [OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) | Defines a struct for the image source information, which is created by calling [OH_ImageSourceInfo_Create](_image___native_module.md#oh_imagesourceinfo_create).| 
26e41f4b71Sopenharmony_ci| typedef struct [OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) [OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) | Defines a struct for decoding parameters, which are used in [OH_ImageSourceNative_CreatePixelmap](_image___native_module.md#oh_imagesourcenative_createpixelmap).| 
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci### Enums
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci| Name| Description| 
32e41f4b71Sopenharmony_ci| -------- | -------- |
33e41f4b71Sopenharmony_ci| [IMAGE_DYNAMIC_RANGE](_image___native_module.md#image_dynamic_range) {<br>IMAGE_DYNAMIC_RANGE_AUTO = 0,<br>IMAGE_DYNAMIC_RANGE_SDR = 1,<br>IMAGE_DYNAMIC_RANGE_HDR = 2 } | Enumerates the desired dynamic range for decoding.| 
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci### Functions
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci| Name| Description| 
39e41f4b71Sopenharmony_ci| -------- | -------- |
40e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceInfo_Create](_image___native_module.md#oh_imagesourceinfo_create) ([OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*\*info) | Creates the pointer to an **OH_ImageSource_Info** object.| 
41e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceInfo_GetWidth](_image___native_module.md#oh_imagesourceinfo_getwidth) ([OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*info, uint32_t \*width) | Obtains the image width.| 
42e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceInfo_GetHeight](_image___native_module.md#oh_imagesourceinfo_getheight) ([OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*info, uint32_t \*height) | Obtains the image height.| 
43e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceInfo_GetDynamicRange](_image___native_module.md#oh_imagesourceinfo_getdynamicrange) ([OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*info, bool \*isHdr) | Obtains the dynamic range of an image.| 
44e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceInfo_Release](_image___native_module.md#oh_imagesourceinfo_release) ([OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*info) | Releases the pointer to an **OH_ImageSource_Info** object.| 
45e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_Create](_image___native_module.md#oh_decodingoptions_create) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*\*options) | Creates the pointer to an **OH_DecodingOptions** object.| 
46e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetPixelFormat](_image___native_module.md#oh_decodingoptions_getpixelformat) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, int32_t \*pixelFormat) | Obtains the pixel format.| 
47e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetPixelFormat](_image___native_module.md#oh_decodingoptions_setpixelformat) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, int32_t pixelFormat) | Sets the pixel format.| 
48e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetIndex](_image___native_module.md#oh_decodingoptions_getindex) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, uint32_t \*index) | Obtains the index of an image.| 
49e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetIndex](_image___native_module.md#oh_decodingoptions_setindex) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, uint32_t index) | Sets the index for an image.| 
50e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetRotate](_image___native_module.md#oh_decodingoptions_getrotate) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, float \*rotate) | Obtains the rotation degree.| 
51e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetRotate](_image___native_module.md#oh_decodingoptions_setrotate) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, float rotate) | Sets the rotation angle.| 
52e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetDesiredSize](_image___native_module.md#oh_decodingoptions_getdesiredsize) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [Image_Size](_image___size.md) \*desiredSize) | Obtains the desired output size.| 
53e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetDesiredSize](_image___native_module.md#oh_decodingoptions_setdesiredsize) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [Image_Size](_image___size.md) \*desiredSize) | Sets the desired output size.| 
54e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetDesiredRegion](_image___native_module.md#oh_decodingoptions_getdesiredregion) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [Image_Region](_image___region.md) \*desiredRegion) | Obtains the region to decode.| 
55e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetDesiredRegion](_image___native_module.md#oh_decodingoptions_setdesiredregion) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [Image_Region](_image___region.md) \*desiredRegion) | Sets the region to decode.| 
56e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_GetDesiredDynamicRange](_image___native_module.md#oh_decodingoptions_getdesireddynamicrange) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, int32_t \*desiredDynamicRange) | Obtains the desired dynamic range configured during decoding.| 
57e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_SetDesiredDynamicRange](_image___native_module.md#oh_decodingoptions_setdesireddynamicrange) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, int32_t desiredDynamicRange) | Sets the desired dynamic range during decoding.| 
58e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_DecodingOptions_Release](_image___native_module.md#oh_decodingoptions_release) ([OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options) | Releases the pointer to an **OH_DecodingOptions** object.| 
59e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreateFromUri](_image___native_module.md#oh_imagesourcenative_createfromuri) (char \*uri, size_t uriSize, [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*\*res) | Creates the pointer to an **OH_ImageSourceNative** object based on a URI.| 
60e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreateFromFd](_image___native_module.md#oh_imagesourcenative_createfromfd) (int32_t fd, [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*\*res) | Creates the pointer to an **OH_ImageSourceNative** object based on a file descriptor.| 
61e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreateFromData](_image___native_module.md#oh_imagesourcenative_createfromdata) (uint8_t \*data, size_t dataSize, [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*\*res) | Creates the pointer to an **OH_ImageSourceNative** object based on buffer data.| 
62e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreateFromRawFile](_image___native_module.md#oh_imagesourcenative_createfromrawfile) (RawFileDescriptor \*rawFile, [OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*\*res) | Creates the pointer to an **OH_ImageSourceNative** object by using the raw file descriptor of an image resource file.| 
63e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreatePixelmap](_image___native_module.md#oh_imagesourcenative_createpixelmap) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, [OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [OH_PixelmapNative](_image___native_module.md#oh_pixelmapnative) \*\*pixelmap) | Creates the pointer to an **OH_PixelmapNative** object based on image decoding parameters.| 
64e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_CreatePixelmapList](_image___native_module.md#oh_imagesourcenative_createpixelmaplist) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, [OH_DecodingOptions](_image___native_module.md#oh_decodingoptions) \*options, [OH_PixelmapNative](_image___native_module.md#oh_pixelmapnative) \*resVecPixMap[], size_t size) | Creates an array of **OH_PixelmapNative** objects based on image decoding parameters.| 
65e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_GetDelayTimeList](_image___native_module.md#oh_imagesourcenative_getdelaytimelist) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, int32_t \*delayTimeList, size_t size) | Obtains the image delay time list.| 
66e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_GetImageInfo](_image___native_module.md#oh_imagesourcenative_getimageinfo) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, int32_t index, [OH_ImageSource_Info](_image___native_module.md#oh_imagesource_info) \*info) | Obtains the information about an image with a given index.| 
67e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_GetImageProperty](_image___native_module.md#oh_imagesourcenative_getimageproperty) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, [Image_String](_image___string.md) \*key, [Image_String](_image___string.md) \*value) | Obtains the value of an image property.| 
68e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_ModifyImageProperty](_image___native_module.md#oh_imagesourcenative_modifyimageproperty) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, [Image_String](_image___string.md) \*key, [Image_String](_image___string.md) \*value) | Modifies the value of an image property.| 
69e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_GetFrameCount](_image___native_module.md#oh_imagesourcenative_getframecount) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source, uint32_t \*frameCount) | Obtains the number of image frames.| 
70e41f4b71Sopenharmony_ci| [Image_ErrorCode](_image___native_module.md#image_errorcode) [OH_ImageSourceNative_Release](_image___native_module.md#oh_imagesourcenative_release) ([OH_ImageSourceNative](_image___native_module.md#oh_imagesourcenative) \*source) | Releases the pointer to an **OH_ImageSourceNative** object.| 
71