struct OH_Pixelmap_ImageInfo
The OH_Pixelmap_ImageInfo struct encapsulates image pixel information at the native layer. It stores the width, height, row stride, pixel format, alpha type, and whether it is an HDR image, and is used to query Pixelmap properties at the native layer.
To create an OH_Pixelmap_ImageInfo object, call OH_PixelmapImageInfo_Create. After use, call OH_PixelmapImageInfo_Release to release the resources. The two functions must be used in pairs; otherwise, memory leaks may occur.
The table below describes the content and operation mode of the OH_Pixelmap_ImageInfo struct.
| Field Type | Field Name | Field Description | Operation Function | Function Description |
|---|---|---|---|---|
| uint32_t | width | Image width, in px. | OH_PixelmapImageInfo_GetWidth | Obtains the image width. |
| uint32_t | height | Image height, in px. | OH_PixelmapImageInfo_GetHeight | Obtains the image height. |
| uint32_t | rowStride | Row stride, which indicates the space occupied by each row of pixels in the memory. Unit: byte. Affected by memory alignment, this value may be greater than the actual number of bytes of pixel data corresponding to the image width. | OH_PixelmapImageInfo_GetRowStride | Obtains the row stride. |
| int32_t | pixelFormat | Pixel format, which indicates the color channel arrangement and bit depth information of the pixel data. For details about the values, see PIXEL_FORMAT. | OH_PixelmapImageInfo_GetPixelFormat | Obtains the pixel format. |
| int32_t | alphaType | Alpha type. For details about the value, see PIXELMAP_ALPHA_TYPE. | OH_PixelmapImageInfo_GetAlphaType | Obtains the alpha type. |
| bool | isHdr | Whether the PixelMap is high dynamic range (HDR). The value true indicates HDR, and false indicates non-HDR. | OH_PixelmapImageInfo_GetDynamicRange | Checks whether the PixelMap is HDR. The value true indicates HDR, and false indicates non-HDR. |
Since: 12
Related module: Image_NativeModule
Header file: pixelmap_native.h