目录

OH_ImageSource_Info

struct OH_ImageSource_Info

Overview

The OH_ImageSource_Info struct describes the image source information encapsulated at the native layer. The struct cannot be directly operated. Instead, functions must be called to create and release the struct and operate the fields in the struct.

Call OH_ImageSourceInfo_Create to create an OH_ImageSource_Info object.

Call OH_ImageSourceNative_GetImageInfo to write the image information from OH_ImageSourceNative into the created OH_ImageSource_Info object.

Call OH_ImageSourceInfo_Release to release the OH_ImageSource_Info object.

Usage restrictions: The OH_ImageSource_Info object is typically used with OH_ImageSourceNative_GetImageInfo to carry information such as the width, height, dynamic range, and MIME type of a specified image. Before use, create the object through OH_ImageSourceInfo_Create. After use, call OH_ImageSourceInfo_Release to release the object.

The table below describes the content and operation mode of the OH_ImageSource_Info struct.

Field Type Field Name Field Description Operation Function Function Description
uint32_t width Image width. OH_ImageSourceInfo_GetWidth Obtains the image width.
uint32_t height Image height. OH_ImageSourceInfo_GetHeight Obtains the image height.
bool isHdr Whether the image is High Dynamic Range (HDR). OH_ImageSourceInfo_GetDynamicRange Obtains whether the image is HDR.
Image_MimeType mimeType MIME type of the image source. OH_ImageSourceInfo_GetMimeType Obtains the MIME type of the image.

mimeType.data obtained through OH_ImageSourceInfo_GetMimeType points to the memory held internally by the OH_ImageSource_Info object. After OH_ImageSourceInfo_Release is called to release OH_ImageSource_Info, this address becomes invalid. If you need to continue using the MIME type data after the release, perform a deep copy before the release.

Since: 12

Related module: Image_NativeModule

Header file: image_source_native.h

Related development guide: Using Image_NativeModule for Image Decoding, Image Region Decoding and Downsampling (C/C++), Using Image_NativeModule for Animated Image Decoding, Using Image_NativeModule for HDR Image Decoding