目录

OH_Pixelmap_InitializationOptions

struct OH_Pixelmap_InitializationOptions

Overview

OH_Pixelmap_InitializationOptions is an initialization options struct encapsulated at the native layer. It specifies properties such as image width, height, pixel format, and alpha type for PixelMap creation. It is suitable for scenarios where a PixelMap needs to be created at the native layer with customized initialization properties.

Use the OH_PixelmapInitializationOptions_Create function to create an OH_Pixelmap_InitializationOptions object. After use, call the OH_PixelmapInitializationOptions_Release function to release 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_InitializationOptions struct.

Field Type Field Name Field Description Operation Function Function Description
uint32_t width Image width, in pixels. The value must be greater than 0, and the maximum value is limited by the system memory. OH_PixelmapInitializationOptions_GetWidth Obtains the image width.
uint32_t width Image width, in pixels. The value must be greater than 0, and the maximum value is limited by the system memory. OH_PixelmapInitializationOptions_SetWidth Sets the image width.
uint32_t height Image height, in pixels. The value must be greater than 0, and the maximum value is limited by the system memory. OH_PixelmapInitializationOptions_GetHeight Obtains the image height.
uint32_t height Image height, in pixels. The value must be greater than 0, and the maximum value is limited by the system memory. OH_PixelmapInitializationOptions_SetHeight Sets the image height.
int32_t pixelFormat Pixel format. For valid values, see PIXEL_FORMAT. Select an appropriate pixel format based on whether the image requires a alpha channel and the memory usage requirements. For the applicable scenarios of each enum value, see the PIXEL_FORMAT Enumeration Description. OH_PixelmapInitializationOptions_GetPixelFormat Obtains the pixel format.
int32_t pixelFormat Pixel format. For valid values, see PIXEL_FORMAT. Select an appropriate pixel format based on whether the image requires a alpha channel and the memory usage requirements. For the applicable scenarios of each enum value, see the PIXEL_FORMAT Enumeration Description. OH_PixelmapInitializationOptions_SetPixelFormat Sets the pixel format.
int32_t alphaType Alpha type. For valid values, see PIXELMAP_ALPHA_TYPE. Select an appropriate type based on whether the image requires premultiplied alpha processing. For the applicable scenarios of each enum value, see the PIXELMAP_ALPHA_TYPE Enumeration Description. OH_PixelmapInitializationOptions_GetAlphaType Obtains the alpha type.
int32_t alphaType Alpha type. For valid values, see PIXELMAP_ALPHA_TYPE. Select an appropriate type based on whether the image requires premultiplied alpha processing. For the applicable scenarios of each enum value, see the PIXELMAP_ALPHA_TYPE Enumeration Description. OH_PixelmapInitializationOptions_SetAlphaType Sets the alpha type.

Since: 12

Related module: Image_NativeModule

Header file: pixelmap_native.h