目录

OH_DecodingOptions

typedef struct OH_DecodingOptions OH_DecodingOptions

Overview

The OH_DecodingOptions struct describes the decoding options encapsulated at the native layer. The struct is used to set decoding options and is passed in as an input parameter for creating a PixelMap. For details, see OH_ImageSourceNative_CreatePixelmap.

The struct cannot be directly operated. Instead, functions must be called to create and release the struct and operate the fields in the struct.

To create an OH_DecodingOptions object, call OH_DecodingOptions_Create.

To release an OH_DecodingOptions object, call OH_DecodingOptions_Release.

Usage restrictions: OH_DecodingOptions is used to configure PixelMap decoding parameters. It is typically used as an input parameter for OH_ImageSourceNative_CreatePixelmap, OH_ImageSourceNative_CreatePixelmapUsingAllocator, or OH_ImageSourceNative_CreatePixelmapList. Before use, an object must be created via OH_DecodingOptions_Create. After use, call OH_DecodingOptions_Release to release the object.

Resource management: Releasing an OH_ImageSourceNative object or a decoded OH_PixelmapNative object does not automatically release the OH_DecodingOptions object. After an OH_DecodingOptions object is released, it should not be passed to decoding APIs or have its field getter and setter functions called.

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

Field Type Field Name Field Description Default Value Getter Function Setter Function
int32_t pixelFormat Pixel format. RGBA_8888 OH_DecodingOptions_GetPixelFormat OH_DecodingOptions_SetPixelFormat
uint32_t index Index of the image to decode. 0 OH_DecodingOptions_GetIndex OH_DecodingOptions_SetIndex
float rotate Rotation angle. Unit: deg. Default value: 0 OH_DecodingOptions_GetRotate OH_DecodingOptions_SetRotate
Image_Size desiredSize Desired output size. Defaults to the original image size. OH_DecodingOptions_GetDesiredSize OH_DecodingOptions_SetDesiredSize
Image_Region desiredRegion Region to decode. Defaults to the region of the full image size. OH_DecodingOptions_GetDesiredRegion OH_DecodingOptions_SetDesiredRegion
int32_t desiredDynamicRange Desired dynamic range. SDR OH_DecodingOptions_GetDesiredDynamicRange OH_DecodingOptions_SetDesiredDynamicRange
int32_t desiredColorSpace Desired color space. Default color space. OH_DecodingOptions_GetDesiredColorSpace OH_DecodingOptions_SetDesiredColorSpace
Image_Region cropRegion Cropping region. Defaults to the region of the full image size. OH_DecodingOptions_GetCropRegion OH_DecodingOptions_SetCropRegion
int32_t cropAndScaleStrategy Crop and scale strategy. 0 OH_DecodingOptions_GetCropAndScaleStrategy OH_DecodingOptions_SetCropAndScaleStrategy

Since: 12

Related module: Image_NativeModule

Header file: image_source_native.h

Related Development Guide: Image Decoding Using Image_NativeModule, Image Region Decoding and Downsampling (C/C++), HDR Image Decoding Using Image_NativeModule