1# image_source_native.h 2 3 4## Overview 5 6The **image_source_native.h** file declares the APIs for image decoding. 7 8**Library**: libimage_source.so 9 10**System capability**: SystemCapability.Multimedia.Image.ImageSource 11 12**Since**: 12 13 14**Related module**: [Image_NativeModule](_image___native_module.md) 15 16 17## Summary 18 19 20### Types 21 22| Name| Description| 23| -------- | -------- | 24| 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.| 25| 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).| 26| 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).| 27 28 29### Enums 30 31| Name| Description| 32| -------- | -------- | 33| [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.| 34 35 36### Functions 37 38| Name| Description| 39| -------- | -------- | 40| [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.| 41| [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.| 42| [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.| 43| [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.| 44| [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.| 45| [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.| 46| [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.| 47| [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.| 48| [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.| 49| [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.| 50| [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.| 51| [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.| 52| [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.| 53| [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.| 54| [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.| 55| [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.| 56| [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.| 57| [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.| 58| [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.| 59| [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.| 60| [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.| 61| [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.| 62| [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.| 63| [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.| 64| [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.| 65| [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.| 66| [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.| 67| [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.| 68| [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.| 69| [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.| 70| [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