openharmony 鸿蒙 capi-pixelmap-native-h

2026-08-25 浏览 (1)

pixelmap_native.h

Overview

The file declares the APIs for accessing a PixelMap.

File to include: <multimedia/image_framework/image/pixelmap_native.h>

Library: libpixelmap.so

System capability: SystemCapability.Multimedia.Image.Core

Since: 12

Related module: Image_NativeModule

Summary

Structs

Nametypedef KeywordDescription
OH_Pixelmap_HdrStaticMetadataOH_Pixelmap_HdrStaticMetadataDescribes the static metadata values available for the key HDR_STATIC_METADATA.
OH_Pixelmap_HdrDynamicMetadataOH_Pixelmap_HdrDynamicMetadataDescribes the dynamic metadata values available for the key HDR_DYNAMIC_METADATA.
OH_Pixelmap_HdrGainmapMetadataOH_Pixelmap_HdrGainmapMetadataDescribes the gain map metadata values available for the key HDR_GAINMAP_METADATA. For details, see ISO 21496-1.
OH_Pixelmap_HdrMetadataValueOH_Pixelmap_HdrMetadataValueDescribes the HDR metadata values used by the PixelMap and available for the key OH_Pixelmap_HdrMetadataKey. It is used in OH_PixelmapNative_SetMetadata and OH_PixelmapNative_GetMetadata. When an OH_Pixelmap_HdrMetadataKey is used as an API input parameter, the value of the corresponding metadata type in this struct is set or retrieved accordingly.
OH_PixelmapNative-Describes an uncompressed PixelMap format, which is encapsulated at the native layer after images are decoded.
To create an OH_PixelmapNative object, call OH_PixelmapNative_CreatePixelmap. By default, BGRA_8888 is used for data processing.
To release an OH_PixelmapNative object, call OH_PixelmapNative_Release.
OH_NativeBuffer-Describes the native buffer, which is used to perform operations related to the native buffer.
OH_NativeColorSpaceManagerOH_NativeColorSpaceManagerDescribes the native color space manager, which is used to perform operations related to the native color space manager.
OH_Pixelmap_InitializationOptions-Describes the initialization options encapsulated at the native layer. The struct is used to set the initialization parameters for a PixelMap.
To create an OH_Pixelmap_InitializationOptions object, call OH_PixelmapInitializationOptions_Create.
To release an OH_Pixelmap_InitializationOptions object, call OH_PixelmapInitializationOptions_Release.
OH_Pixelmap_ImageInfo-Describes the image information.

Enums

Nametypedef KeywordDescription
PIXELMAP_ALPHA_TYPEPIXELMAP_ALPHA_TYPEEnumerates the alpha types of a PixelMap.
PIXEL_FORMATPIXEL_FORMATEnumerates the image pixel formats.
OH_PixelmapNative_AntiAliasingLevelOH_PixelmapNative_AntiAliasingLevelEnumerates the anti-aliasing levels used for scaling PixelMaps.
OH_Pixelmap_HdrMetadataKeyOH_Pixelmap_HdrMetadataKeyEnumerates the keys of the HDR metadata information used by the PixelMap. It is used in OH_PixelmapNative_SetMetadata and OH_PixelmapNative_GetMetadata.
OH_Pixelmap_HdrMetadataTypeOH_Pixelmap_HdrMetadataTypeEnumerates the HDR metadata types, which are the values of HDR_METADATA_TYPE.

Functions

NameDescription
Image_ErrorCode OH_PixelmapInitializationOptions_Create(OH_Pixelmap_InitializationOptions **options)Creates the pointer to an OH_Pixelmap_InitializationOptions struct.
Image_ErrorCode OH_PixelmapInitializationOptions_GetWidth(OH_Pixelmap_InitializationOptions *options, uint32_t *width)Obtains the image width.
Image_ErrorCode OH_PixelmapInitializationOptions_SetWidth(OH_Pixelmap_InitializationOptions *options, uint32_t width)Sets the image width.
Image_ErrorCode OH_PixelmapInitializationOptions_GetHeight(OH_Pixelmap_InitializationOptions *options, uint32_t *height)Obtains the image height.
Image_ErrorCode OH_PixelmapInitializationOptions_SetHeight(OH_Pixelmap_InitializationOptions *options, uint32_t height)Sets the image height.
Image_ErrorCode OH_PixelmapInitializationOptions_GetPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t *pixelFormat)Obtains the pixel format.
Image_ErrorCode OH_PixelmapInitializationOptions_SetPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t pixelFormat)Sets the pixel format.
Image_ErrorCode OH_PixelmapInitializationOptions_GetSrcPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t *srcpixelFormat)Obtains the source pixel format.
Image_ErrorCode OH_PixelmapInitializationOptions_SetSrcPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t srcpixelFormat)Sets the source pixel format.
Image_ErrorCode OH_PixelmapInitializationOptions_GetRowStride(OH_Pixelmap_InitializationOptions *options, int32_t *rowStride)Obtains the row stride.
The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width *Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes.
Image_ErrorCode OH_PixelmapInitializationOptions_SetRowStride(OH_Pixelmap_InitializationOptions *options, int32_t rowStride)Sets the row stride.
The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width *Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes.
Image_ErrorCode OH_PixelmapInitializationOptions_GetAlphaType(OH_Pixelmap_InitializationOptions *options, int32_t *alphaType)Obtains the alpha type.
Image_ErrorCode OH_PixelmapInitializationOptions_SetAlphaType(OH_Pixelmap_InitializationOptions *options, int32_t alphaType)Sets the alpha type.
Image_ErrorCode OH_PixelmapInitializationOptions_GetEditable(OH_Pixelmap_InitializationOptions *options, bool *editable)Obtains the editable flag.
Image_ErrorCode OH_PixelmapInitializationOptions_SetEditable(OH_Pixelmap_InitializationOptions *options, bool editable)Sets the editable flag.
Image_ErrorCode OH_PixelmapInitializationOptions_Release(OH_Pixelmap_InitializationOptions *options)Releases the pointer to an OH_Pixelmap_InitializationOptions struct.
Image_ErrorCode OH_PixelmapImageInfo_Create(OH_Pixelmap_ImageInfo **info)Creates the pointer to an OH_Pixelmap_ImageInfo struct.
Image_ErrorCode OH_PixelmapImageInfo_GetWidth(OH_Pixelmap_ImageInfo *info, uint32_t *width)Obtains the image width.
Image_ErrorCode OH_PixelmapImageInfo_GetHeight(OH_Pixelmap_ImageInfo *info, uint32_t *height)Obtains the image height.
Image_ErrorCode OH_PixelmapImageInfo_GetAlphaMode(OH_Pixelmap_ImageInfo *info, int32_t *alphaMode)Obtains the alpha type of an image.
Image_ErrorCode OH_PixelmapImageInfo_GetRowStride(OH_Pixelmap_ImageInfo *info, uint32_t *rowStride)Obtains the row stride.
Image_ErrorCode OH_PixelmapImageInfo_GetPixelFormat(OH_Pixelmap_ImageInfo *info, int32_t *pixelFormat)Obtains the pixel format.
Image_ErrorCode OH_PixelmapImageInfo_GetAlphaType(OH_Pixelmap_ImageInfo *info, int32_t *alphaType)Obtains the default alpha type from OH_PixelmapImageInfo. To obtain the current alpha channel type of the image, call OH_PixelmapImageInfo_GetAlphaMode.
Image_ErrorCode OH_PixelmapImageInfo_GetDynamicRange(OH_Pixelmap_ImageInfo *info, bool *isHdr)Obtains the dynamic range of a PixelMap.
Image_ErrorCode OH_PixelmapImageInfo_Release(OH_Pixelmap_ImageInfo *info)Releases the pointer to an OH_Pixelmap_ImageInfo struct.
Image_ErrorCode OH_PixelmapNative_CreatePixelmap(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap)Creates a PixelMap based on the pixel data and image properties. The input pixel data is parsed in BGRA_8888 format by default. To use another format, see OH_PixelmapInitializationOptions_SetSrcPixelFormat.
Image_ErrorCode OH_PixelmapNative_CreatePixelmapUsingAllocator(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap)Creates a PixelMap based on the pixel data and image properties. You can specify the memory type via the allocator. The input pixel data is parsed in BGRA_8888 format by default. To use another format, see OH_PixelmapInitializationOptions_SetSrcPixelFormat. By default, the system selects an appropriate memory type based on the image type, image size, and platform capability. When processing the returned PixelMap object, consider the impact of stride.
Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeToNapi(napi_env env, OH_PixelmapNative *pixelmapNative, napi_value *pixelmapNapi)Converts a nativePixelMap object to a PixelMapnapi object.
Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeFromNapi(napi_env env, napi_value pixelmapNapi, OH_PixelmapNative **pixelmapNative)Converts a PixelMapnapi object to a nativePixelMap object.
Image_ErrorCode OH_PixelmapNative_ReadPixels(OH_PixelmapNative *pixelmap, uint8_t *destination, size_t *bufferSize)Reads the pixels of a PixelMap and writes the result to the buffer based on the pixel format of the PixelMap.
Image_ErrorCode OH_PixelmapNative_WritePixels(OH_PixelmapNative *pixelmap, uint8_t *source, size_t bufferSize)Reads the pixels in the buffer and writes the result to the PixelMap based on the pixel format of the PixelMap.
Image_ErrorCode OH_PixelmapNative_ReadPixelsFromArea(OH_PixelmapNative *pixelmap, Image_PositionArea *area)Reads pixels from the specified area in a PixelMap and stores the result to the buffer. The read data is in BGRA_8888 format.
Image_ErrorCode OH_PixelmapNative_WritePixelsToArea(OH_PixelmapNative *pixelmap, Image_PositionArea *area)Writes pixels in the buffer to the specified area in a PixelMap. The data source must be in BGRA_8888 format.
Image_ErrorCode OH_PixelmapNative_GetArgbPixels(OH_PixelmapNative *pixelmap, uint8_t *destination, size_t *bufferSize)Reads data in ARGB format from a PixelMap.
Image_ErrorCode OH_PixelmapNative_ToSdr(OH_PixelmapNative *pixelmap)Converts a PixelMap from the HDR format to the SDR format.
Image_ErrorCode OH_PixelmapNative_GetImageInfo(OH_PixelmapNative *pixelmap, OH_Pixelmap_ImageInfo *imageInfo)Obtains the image information of a PixelMap.
Image_ErrorCode OH_PixelmapNative_Opacity(OH_PixelmapNative *pixelmap, float rate)Sets the opacity rate to enable the PixelMap to achieve the corresponding opacity effect.
Image_ErrorCode OH_PixelmapNative_Scale(OH_PixelmapNative *pixelmap, float scaleX, float scaleY)Scales a PixelMap based on a given width and height.
Image_ErrorCode OH_PixelmapNative_ScaleWithAntiAliasing(OH_PixelmapNative *pixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level)Scales a PixelMap based on the specified anti-aliasing level, width, and height.
Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMap(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap, float scaleX, float scaleY)Creates an image that has been resized based on the scale factors of the width and height. The generated PixelMap is not editable.
Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level)Creates an image that has been resized based on the specified anti-aliasing level and the scale factors of the width and height. The generated PixelMap is not editable.
Image_ErrorCode OH_PixelmapNative_CreateAlphaPixelmap(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap)Creates a PixelMap that contains only the alpha channel from the source PixelMap. The generated PixelMap is not editable.
Image_ErrorCode OH_PixelmapNative_Clone(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap)Clones a new PixelMap from the source PixelMap.
Image_ErrorCode OH_PixelmapNative_CreateCroppedAndScaledPixelMap(OH_PixelmapNative *srcPixelmap, Image_Region *region, Image_Scale *scale, OH_PixelmapNative_AntiAliasingLevel level, OH_PixelmapNative **dstPixelmap)Creates a PixelMap that is cropped and resized based on the source PixelMap.
Image_ErrorCode OH_PixelmapNative_Translate(OH_PixelmapNative *pixelmap, float x, float y)Translates a PixelMap based on given coordinates.
Image_ErrorCode OH_PixelmapNative_Rotate(OH_PixelmapNative *pixelmap, float angle)Rotates a PixelMap based on a given angle.
Image_ErrorCode OH_PixelmapNative_Flip(OH_PixelmapNative *pixelmap, bool shouldFlipHorizontally, bool shouldFlipVertically)Flips a PixelMap based on a given angle.
Image_ErrorCode OH_PixelmapNative_Crop(OH_PixelmapNative *pixelmap, Image_Region *region)Crops a PixelMap based on a given size.
Image_ErrorCode OH_PixelmapNative_Release(OH_PixelmapNative *pixelmap)Releases the pointer to an OH_PixelmapNative object. OH_PixelmapNative_Destroy is recommended.
Image_ErrorCode OH_PixelmapNative_Destroy(OH_PixelmapNative **pixelmap)Releases the pointer to an OH_PixelmapNative object.
Image_ErrorCode OH_PixelmapNative_ConvertAlphaFormat(OH_PixelmapNative* srcpixelmap, OH_PixelmapNative* dstpixelmap, const bool isPremul)Converts pixel data of a PixelMap from premultiplied alpha to non-premultiplied alpha, or vice versa.
Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmap(OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap)Creates an empty PixelMap object based on OH_Pixelmap_InitializationOptions. The memory data is 0.
Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator(OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap)Creates an empty PixelMap object based on the options and memory type, where allocator specifies the memory type of the PixelMap. By default, the system selects an appropriate memory type based on the image type, image size, and platform capability. When processing the returned PixelMap object, consider the impact of stride.
Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromSurface(const char *surfaceId, size_t length, OH_PixelmapNative **pixelmap)Creates a PixelMap from a surface with the specified surface ID.
Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromSurfaceWithTransformation(const char *surfaceId, size_t length, bool transformEnabled, OH_PixelmapNative **pixelmap)Creates a PixelMap object for previewing a stream based on a surface ID. The surface may carry rotation or flipping information.
Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromNativeBuffer(OH_NativeBuffer *nativeBuffer, OH_PixelmapNative **pixelmap)Creates a PixelMap using a NativeBuffer. If the CPU access permission is not configured for the NativeBuffer, the PixelMap cannot be created.
The supported pixel formats are RGBA_8888, NV21, NV12, YCBCR_P010, and YCRCB_P010.
Image_ErrorCode OH_PixelmapNative_GetNativeBuffer(OH_PixelmapNative *pixelmap, OH_NativeBuffer **nativeBuffer)Obtains the NativeBuffer object from a PixelMap in the DMA memory.
Image_ErrorCode OH_PixelmapNative_GetMetadata(OH_PixelmapNative *pixelmap, OH_Pixelmap_HdrMetadataKey key, OH_Pixelmap_HdrMetadataValue **value)Obtains the metadata.
Image_ErrorCode OH_PixelmapNative_SetMetadata(OH_PixelmapNative *pixelmap, OH_Pixelmap_HdrMetadataKey key, OH_Pixelmap_HdrMetadataValue *value)Sets the metadata.
Image_ErrorCode OH_PixelmapNative_SetColorSpaceNative(OH_PixelmapNative *pixelmap, OH_NativeColorSpaceManager *colorSpaceNative)Sets a NativeColorSpaceManager object.
Image_ErrorCode OH_PixelmapNative_GetColorSpaceNative(OH_PixelmapNative *pixelmap, OH_NativeColorSpaceManager **colorSpaceNative)Obtains a NativeColorSpaceManager object.
Image_ErrorCode OH_PixelmapNative_SetMemoryName(OH_PixelmapNative *pixelmap, char *name, size_t *size)Sets the memory name of a PixelMap.
Image_ErrorCode OH_PixelmapNative_GetByteCount(OH_PixelmapNative *pixelmap, uint32_t *byteCount)Obtains the total number of bytes occupied by all pixels in a PixelMap, excluding any memory padding.
Image_ErrorCode OH_PixelmapNative_GetAllocationByteCount(OH_PixelmapNative *pixelmap, uint32_t *allocationByteCount)Obtains the number of bytes in the memory allocated by a PixelMap to store pixels.
Image_ErrorCode OH_PixelmapNative_AccessPixels(OH_PixelmapNative *pixelmap, void **addr)Obtains the memory address where the pixels of a PixelMap are stored and locks the memory.
When the memory is locked, any attempts to alter or free the pixel data of the PixelMap will fail or be ineffective.
Image_ErrorCode OH_PixelmapNative_UnaccessPixels(OH_PixelmapNative *pixelmap)Unlocks the memory allocated to store the pixels of a PixelMap.
This function must be used together with OH_PixelmapNative_AccessPixels.
Image_ErrorCode OH_PixelmapNative_GetUniqueId(OH_PixelmapNative *pixelmap, uint32_t *uniqueId)Obtains the unique ID of a PixelMap.
Image_ErrorCode OH_PixelmapNative_IsReleased(OH_PixelmapNative *pixelmap, bool *released)Checks whether a PixelMap is released. If released, any attempt to access the internal data of this object will fail.

Enum Description

PIXELMAP_ALPHA_TYPE

enum PIXELMAP_ALPHA_TYPE

Description

Enumerates the alpha types of a PixelMap.

Since: 12

Enum ItemDescription
PIXELMAP_ALPHA_TYPE_UNKNOWN = 0Unknown format.
PIXELMAP_ALPHA_TYPE_OPAQUE = 1Opaque format.
PIXELMAP_ALPHA_TYPE_PREMULTIPLIED = 2Premultiplied format.
PIXELMAP_ALPHA_TYPE_UNPREMULTIPLIED = 3Non-premultiplied format.

PIXEL_FORMAT

enum PIXEL_FORMAT

Description

Enumerates the image pixel formats.

Since: 12

Enum ItemDescription
PIXEL_FORMAT_UNKNOWN = 0Unknown format.
PIXEL_FORMAT_RGB_565 = 2RGB_565 format.
PIXEL_FORMAT_RGBA_8888 = 3RGBA_8888 format.
PIXEL_FORMAT_BGRA_8888 = 4BGRA_8888 format.
PIXEL_FORMAT_RGB_888 = 5RGB_888 format.
PIXEL_FORMAT_ALPHA_8 = 6ALPHA_8 format.
PIXEL_FORMAT_RGBA_F16 = 7RGBA_F16 format.
PIXEL_FORMAT_NV21 = 8NV21 format.
PIXEL_FORMAT_NV12 = 9NV12 format.
PIXEL_FORMAT_RGBA_1010102 = 10RGBA_1010102 format.
PIXEL_FORMAT_YCBCR_P010 = 11YCBCR_P010 format.
PIXEL_FORMAT_YCRCB_P010 = 12YCRCB_P010 format.

OH_PixelmapNative_AntiAliasingLevel

enum OH_PixelmapNative_AntiAliasingLevel

Description

Enumerates the anti-aliasing levels used for scaling PixelMaps.

Since: 12

Enum ItemDescription
OH_PixelmapNative_AntiAliasing_NONE = 0Nearest neighbor interpolation.
OH_PixelmapNative_AntiAliasing_LOW = 1Bilinear interpolation.
OH_PixelmapNative_AntiAliasing_MEDIUM = 2Bilinear interpolation with mipmap enabled. You are advised to use this value when zooming out an image.
OH_PixelmapNative_AntiAliasing_HIGH = 3Cubic interpolation.

OH_Pixelmap_HdrMetadataKey

enum OH_Pixelmap_HdrMetadataKey

Description

Enumerates the keys of the HDR metadata information used by the PixelMap. It is used in OH_PixelmapNative_SetMetadata and OH_PixelmapNative_GetMetadata.

Since: 12

Enum ItemDescription
HDR_METADATA_TYPE = 0Metadata type used by the PixelMap.
HDR_STATIC_METADATA = 1Static metadata.
HDR_DYNAMIC_METADATA = 2Dynamic metadata.
HDR_GAINMAP_METADATA = 3Metadata used by gain maps.

OH_Pixelmap_HdrMetadataType

enum OH_Pixelmap_HdrMetadataType

Description

Enumerates the HDR metadata types, which are the values of HDR_METADATA_TYPE.

Since: 12

Enum ItemDescription
HDR_METADATA_TYPE_NONE = 0No metadata.
HDR_METADATA_TYPE_BASE = 1Metadata used for base graphics.
HDR_METADATA_TYPE_GAINMAP = 2Metadata used for gain maps.
HDR_METADATA_TYPE_ALTERNATE = 3Metadata used for synthesized HDR graphics.

Function Description

OH_PixelmapInitializationOptions_Create()

Image_ErrorCode OH_PixelmapInitializationOptions_Create(OH_Pixelmap_InitializationOptions **options)

Description

Creates the pointer to an OH_Pixelmap_InitializationOptions struct.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions **optionsDouble pointer to the OH_Pixelmap_InitializationOptions struct created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetWidth()

Image_ErrorCode OH_PixelmapInitializationOptions_GetWidth(OH_Pixelmap_InitializationOptions *options, uint32_t *width)

Description

Obtains the image width.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
uint32_t *widthPointer to the image width, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetWidth()

Image_ErrorCode OH_PixelmapInitializationOptions_SetWidth(OH_Pixelmap_InitializationOptions *options, uint32_t width)

Description

Sets the image width.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
uint32_t widthImage width, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetHeight()

Image_ErrorCode OH_PixelmapInitializationOptions_GetHeight(OH_Pixelmap_InitializationOptions *options, uint32_t *height)

Description

Obtains the image height.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
uint32_t *heightPointer to the image height, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetHeight()

Image_ErrorCode OH_PixelmapInitializationOptions_SetHeight(OH_Pixelmap_InitializationOptions *options, uint32_t height)

Description

Sets the image height.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
uint32_t heightImage height, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetPixelFormat()

Image_ErrorCode OH_PixelmapInitializationOptions_GetPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t *pixelFormat)

Description

Obtains the pixel format.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t *pixelFormatPointer to the pixel format. For details about the available options, see PIXEL_FORMAT.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetPixelFormat()

Image_ErrorCode OH_PixelmapInitializationOptions_SetPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t pixelFormat)

Description

Sets the pixel format.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t pixelFormatPixel format. For details about the available options, see PIXEL_FORMAT.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetSrcPixelFormat()

Image_ErrorCode OH_PixelmapInitializationOptions_GetSrcPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t *srcpixelFormat)

Description

Obtains the source pixel format.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t *srcpixelFormatPointer to the pixel format. For details about the available options, see PIXEL_FORMAT.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetSrcPixelFormat()

Image_ErrorCode OH_PixelmapInitializationOptions_SetSrcPixelFormat(OH_Pixelmap_InitializationOptions *options, int32_t srcpixelFormat)

Description

Sets the source pixel format.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t srcpixelFormatSource pixel format. For details about the available options, see PIXEL_FORMAT.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetRowStride()

Image_ErrorCode OH_PixelmapInitializationOptions_GetRowStride(OH_Pixelmap_InitializationOptions *options, int32_t *rowStride)

Description

Obtains the row stride.
The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width *Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t *rowStridePointer to the stride, in bytes.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNKNOWN_ERROR: The struct that options points to is released.

OH_PixelmapInitializationOptions_SetRowStride()

Image_ErrorCode OH_PixelmapInitializationOptions_SetRowStride(OH_Pixelmap_InitializationOptions *options, int32_t rowStride)

Description

Sets the row stride.
The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width *Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t rowStrideStride, in bytes.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNKNOWN_ERROR: The struct that options points to is released.

OH_PixelmapInitializationOptions_GetAlphaType()

Image_ErrorCode OH_PixelmapInitializationOptions_GetAlphaType(OH_Pixelmap_InitializationOptions *options, int32_t *alphaType)

Description

Obtains the alpha type.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t *alphaTypePointer to the alpha type. For details about the alpha types, see PIXELMAP_ALPHA_TYPE.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetAlphaType()

Image_ErrorCode OH_PixelmapInitializationOptions_SetAlphaType(OH_Pixelmap_InitializationOptions *options, int32_t alphaType)

Description

Sets the alpha type.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
int32_t alphaTypeAlpha type. For details about the alpha types, see PIXELMAP_ALPHA_TYPE.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_GetEditable()

Image_ErrorCode OH_PixelmapInitializationOptions_GetEditable(OH_Pixelmap_InitializationOptions *options, bool *editable)

Description

Obtains the editable flag.

Since: 18

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
bool *editablePointer to the editable flag. true if editable, false otherwise.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_SetEditable()

Image_ErrorCode OH_PixelmapInitializationOptions_SetEditable(OH_Pixelmap_InitializationOptions *options, bool editable)

Description

Sets the editable flag.

Since: 18

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.
bool editableEditable flag. true if editable, false otherwise.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapInitializationOptions_Release()

Image_ErrorCode OH_PixelmapInitializationOptions_Release(OH_Pixelmap_InitializationOptions *options)

Description

Releases the pointer to an OH_Pixelmap_InitializationOptions struct.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to an OH_Pixelmap_InitializationOptions struct.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_Create()

Image_ErrorCode OH_PixelmapImageInfo_Create(OH_Pixelmap_ImageInfo **info)

Description

Creates the pointer to an OH_Pixelmap_ImageInfo struct.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo **infoDouble pointer to the OH_Pixelmap_ImageInfo struct created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetWidth()

Image_ErrorCode OH_PixelmapImageInfo_GetWidth(OH_Pixelmap_ImageInfo *info, uint32_t *width)

Description

Obtains the image width.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
uint32_t *widthPointer to the image width, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetHeight()

Image_ErrorCode OH_PixelmapImageInfo_GetHeight(OH_Pixelmap_ImageInfo *info, uint32_t *height)

Description

Obtains the image height.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
uint32_t *heightPointer to the image height, in px.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetAlphaMode()

Image_ErrorCode OH_PixelmapImageInfo_GetAlphaMode(OH_Pixelmap_ImageInfo *info, int32_t *alphaMode)

Description

Obtains the alpha type of an image.

Since: 20

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
int32_t *AlphaModePointer to the alpha format.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetRowStride()

Image_ErrorCode OH_PixelmapImageInfo_GetRowStride(OH_Pixelmap_ImageInfo *info, uint32_t *rowStride)

Description

Obtains the row stride.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
uint32_t *rowStridePointer to the row stride, which is the number of bytes from one row of pixels in memory to the next row of pixels in memory.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetPixelFormat()

Image_ErrorCode OH_PixelmapImageInfo_GetPixelFormat(OH_Pixelmap_ImageInfo *info, int32_t *pixelFormat)

Description

Obtains the pixel format.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
int32_t *pixelFormatPointer to the pixel format. For details about the available options, see PIXEL_FORMAT.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetAlphaType()

Image_ErrorCode OH_PixelmapImageInfo_GetAlphaType(OH_Pixelmap_ImageInfo *info, int32_t *alphaType)

Description

Obtains the default alpha type from OH_PixelmapImageInfo. To obtain the current alpha channel type of the image, call OH_PixelmapImageInfo_GetAlphaMode.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
int32_t *alphaTypePointer to the alpha type. For details about the alpha types, see PIXELMAP_ALPHA_TYPE.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_GetDynamicRange()

Image_ErrorCode OH_PixelmapImageInfo_GetDynamicRange(OH_Pixelmap_ImageInfo *info, bool *isHdr)

Description

Obtains the dynamic range of a PixelMap.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.
bool *isHdrWhether the image is an HDR image. The value true means that the image is an HDR image, and the value false means the opposite.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapImageInfo_Release()

Image_ErrorCode OH_PixelmapImageInfo_Release(OH_Pixelmap_ImageInfo *info)

Description

Releases the pointer to an OH_Pixelmap_ImageInfo struct.

Since: 12

Parameters

NameDescription
OH_Pixelmap_ImageInfo *infoPointer to an OH_Pixelmap_ImageInfo struct.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_CreatePixelmap()

Image_ErrorCode OH_PixelmapNative_CreatePixelmap(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap)

Description

Creates a PixelMap based on the pixel data and image properties. The input pixel data is parsed in BGRA_8888 format by default. To use another format, see OH_PixelmapInitializationOptions_SetSrcPixelFormat.

Since: 12

Parameters

NameDescription
uint8_t *dataPointer to the color array in BGRA_8888 format.
size_t dataLengthSize of the array.
OH_Pixelmap_InitializationOptions *optionsPointer to the properties.
OH_PixelmapNative **pixelmapDouble pointer to the OH_PixelmapNative object created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported.

OH_PixelmapNative_CreatePixelmapUsingAllocator()

Image_ErrorCode OH_PixelmapNative_CreatePixelmapUsingAllocator(uint8_t *data, size_t dataLength, OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap)

Description

Creates a PixelMap based on the pixel data and image properties. You can specify the memory type via the allocator. The input pixel data is parsed in BGRA_8888 format by default. To use another format, see OH_PixelmapInitializationOptions_SetSrcPixelFormat. By default, the system selects an appropriate memory type based on the image type, image size, and platform capability. When processing the returned PixelMap object, consider the impact of stride.

Since: 20

Parameters

NameDescription
uint8_t *dataPointer to the color array in BGRA_8888 format.
size_t dataLengthSize of the array.
OH_Pixelmap_InitializationOptions *optionsPointer to the options used for creating the PixelMap.
IMAGE_ALLOCATOR_MODE allocatorType of memory allocation for the PixelMap.
OH_PixelmapNative **pixelmapDouble pointer to the OH_PixelmapNative object created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported.
IMAGE_TOO_LARGE: The image is too large to allocate memory.
IMAGE_DMA_OPERATION_FAILED: The DMA memory operation fails.
IMAGE_ALLOCATOR_MODE_UNSUPPORTED: The current memory allocation type is not supported, for example, creating an HDR image using shared memory.

OH_PixelmapNative_ConvertPixelmapNativeToNapi()

Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeToNapi(napi_env env, OH_PixelmapNative *pixelmapNative, napi_value *pixelmapNapi)

Description

Converts a nativePixelMap object to a PixelMapnapi object.

Since: 12

Parameters

NameDescription
napi_env envPointer to the NAPI environment.
OH_PixelmapNative *pixelmapNativePointer to an OH_PixelmapNative object.
napi_value *pixelmapNapiDouble pointer to the PixelMapnapi object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: The pixelmapNative parameter is nullptr.

OH_PixelmapNative_ConvertPixelmapNativeFromNapi()

Image_ErrorCode OH_PixelmapNative_ConvertPixelmapNativeFromNapi(napi_env env, napi_value pixelmapNapi, OH_PixelmapNative **pixelmapNative)

Description

Converts a PixelMapnapi object to a nativePixelMap object.

Since: 12

Parameters

NameDescription
napi_env envPointer to the NAPI environment.
napi_value pixelmapNapiPixelMapNapi object.
OH_PixelmapNative **pixelmapNativeDouble pointer to the OH_PixelmapNative object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: pixelmapNative is nullptr or pixelmapNapi is not an PixelMapNapi object.

OH_PixelmapNative_ReadPixels()

Image_ErrorCode OH_PixelmapNative_ReadPixels(OH_PixelmapNative *pixelmap, uint8_t *destination, size_t *bufferSize)

Description

Reads the pixels of a PixelMap and writes the result to the buffer based on the pixel format of the PixelMap.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
uint8_t *destinationPointer to the buffer to which the pixels will be written.
size_t *bufferSizePointer to the buffer size. The buffer size of the RGBA format is equal to width * height * 4, and the buffer size of the NV21 and NV12 formats is equal to width * height+((width+1)/2) * ((height+1)/2) * 2.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_PixelmapNative_WritePixels()

Image_ErrorCode OH_PixelmapNative_WritePixels(OH_PixelmapNative *pixelmap, uint8_t *source, size_t bufferSize)

Description

Reads the pixels in the buffer and writes the result to the PixelMap based on the pixel format of the PixelMap.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
uint8_t *sourcePointer to the buffer from which the pixels will be read.
size_t bufferSizeBuffer size.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_PixelmapNative_ReadPixelsFromArea()

Image_ErrorCode OH_PixelmapNative_ReadPixelsFromArea(OH_PixelmapNative *pixelmap, Image_PositionArea *area)

Description

Reads pixels from the specified area in a PixelMap and stores the result to the buffer. The read data is in BGRA_8888 format.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the PixelMap from which pixels are read.
Image_PositionArea *areaPointer to the area in the PixelMap. The data is read and copied to area->pixels.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, pixelmap or area is incorrect.
IMAGE_UNKNOWN_ERROR: Unknown internal error. For example, the pixel format is not supported.

OH_PixelmapNative_WritePixelsToArea()

Image_ErrorCode OH_PixelmapNative_WritePixelsToArea(OH_PixelmapNative *pixelmap, Image_PositionArea *area)

Description

Writes pixels in the buffer to the specified area in a PixelMap. The data source must be in BGRA_8888 format.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the PixelMap to which pixels are written.
Image_PositionArea *areaPointer to the area in the PixelMap.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, pixelmap or area is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The PixelMap is not editable.
IMAGE_UNKNOWN_ERROR: Unknown internal error. For example, the pixel format is not supported.

OH_PixelmapNative_GetArgbPixels()

Image_ErrorCode OH_PixelmapNative_GetArgbPixels(OH_PixelmapNative *pixelmap, uint8_t *destination, size_t *bufferSize)

Description

Reads data in ARGB format from a PixelMap.

Since: 13

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
uint8_t *destinationPointer to the buffer to which the pixels will be written.
size_t *bufferSizePointer to the buffer size.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_CONVERSION: The PixelMap format does not support reading ARGB data.
IMAGE_ALLOC_FAILED: Memory allocation fails.
IMAGE_COPY_FAILED: Memory data copy, read, or operation fails.

OH_PixelmapNative_ToSdr()

Image_ErrorCode OH_PixelmapNative_ToSdr(OH_PixelmapNative *pixelmap)

Description

Converts a PixelMap from the HDR format to the SDR format.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported.

OH_PixelmapNative_GetImageInfo()

Image_ErrorCode OH_PixelmapNative_GetImageInfo(OH_PixelmapNative *pixelmap, OH_Pixelmap_ImageInfo *imageInfo)

Description

Obtains the image information of a PixelMap.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
OH_Pixelmap_ImageInfo *imageInfoPointer to the image information.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Opacity()

Image_ErrorCode OH_PixelmapNative_Opacity(OH_PixelmapNative *pixelmap, float rate)

Description

Sets the opacity rate to enable the PixelMap to achieve the corresponding opacity effect.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
float rateOpacity rate.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Scale()

Image_ErrorCode OH_PixelmapNative_Scale(OH_PixelmapNative *pixelmap, float scaleX, float scaleY)

Description

Scales a PixelMap based on a given width and height.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
float scaleXScale ratio of the width.
float scaleYScale ratio of the height.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_ScaleWithAntiAliasing()

Image_ErrorCode OH_PixelmapNative_ScaleWithAntiAliasing(OH_PixelmapNative *pixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level)

Description

Scales a PixelMap based on the specified anti-aliasing level, width, and height.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
float scaleXScale ratio of the width.
float scaleYScale ratio of the height.
OH_PixelmapNative_AntiAliasingLevel levelAnti-aliasing level.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_TOO_LARGE: The image is too large.
IMAGE_ALLOC_FAILED: Memory allocation fails.
IMAGE_UNKNOWN_ERROR: The struct that pixelmap points to is released.

OH_PixelmapNative_CreateScaledPixelMap()

Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMap(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap, float scaleX, float scaleY)

Description

Creates an image that has been resized based on the scale factors of the width and height. The generated PixelMap is not editable.

Since: 18

Parameters

NameDescription
OH_PixelmapNative *srcPixelmapPointer to the source PixelMap, which is an OH_PixelmapNative object.
OH_PixelmapNative **dstPixelmapDouble pointer to the destination PixelMap, which is an OH_PixelmapNative object.
float scaleXScale ratio of the width.
float scaleYScale ratio of the height.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing()

Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level)

Description

Creates an image that has been resized based on the specified anti-aliasing level and the scale factors of the width and height. The generated PixelMap is not editable.

Since: 18

Parameters

NameDescription
OH_PixelmapNative *srcPixelmapPointer to the source PixelMap, which is an OH_PixelmapNative object.
OH_PixelmapNative **dstPixelmapDouble pointer to the destination PixelMap, which is an OH_PixelmapNative object.
float scaleXScale ratio of the width.
float scaleYScale ratio of the height.
OH_PixelmapNative_AntiAliasingLevel levelAnti-aliasing level.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_TOO_LARGE: The image is too large.
IMAGE_ALLOC_FAILED: Memory allocation fails.

OH_PixelmapNative_CreateAlphaPixelmap()

Image_ErrorCode OH_PixelmapNative_CreateAlphaPixelmap(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap)

Description

Creates a PixelMap that contains only the alpha channel from the source PixelMap. The generated PixelMap is not editable.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *srcPixelmapPointer to the source PixelMap.
OH_PixelmapNative **dstPixelmapDouble pointer to the destination PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, srcPixelmap or dstPixelmap is incorrect.

OH_PixelmapNative_Clone()

Image_ErrorCode OH_PixelmapNative_Clone(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap)

Description

Clones a new PixelMap from the source PixelMap.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *srcPixelmapPointer to the source PixelMap.
OH_PixelmapNative **dstPixelmapDouble pointer to the destination PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, srcPixelmap or dstPixelmap is incorrect.
IMAGE_UNSUPPORTED_DATA_FORMAT: The pixel format is not supported.
IMAGE_TOO_LARGE: The source PixelMap is too large.
IMAGE_INIT_FAILED: The destination PixelMap fails to be initialized.
IMAGE_ALLOC_FAILED: Memory allocation or data copy fails.

OH_PixelmapNative_CreateCroppedAndScaledPixelMap()

Image_ErrorCode OH_PixelmapNative_CreateCroppedAndScaledPixelMap(OH_PixelmapNative *srcPixelmap, Image_Region *region, Image_Scale *scale, OH_PixelmapNative_AntiAliasingLevel level, OH_PixelmapNative **dstPixelmap)

Description

Creates a PixelMap that is cropped and resized based on the source PixelMap.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *srcPixelmapPointer to the source PixelMap.
Image_Region *regionPointer to the region to crop.
Image_Scale *scalePointer to the scale factor of the width and height. It must not be 0.
OH_PixelmapNative_AntiAliasingLevel levelScale interpolation algorithm.
OH_PixelmapNative **dstPixelmapDouble pointer to the destination PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, srcPixelmap, region, scale, or dstPixelmap is incorrect.
IMAGE_UNSUPPORTED_DATA_FORMAT: The pixel format is not supported.
IMAGE_TOO_LARGE: The source PixelMap is too large.
IMAGE_INIT_FAILED: The destination PixelMap fails to be initialized.
IMAGE_ALLOC_FAILED: Memory allocation or data copy fails.

OH_PixelmapNative_Translate()

Image_ErrorCode OH_PixelmapNative_Translate(OH_PixelmapNative *pixelmap, float x, float y)

Description

Translates a PixelMap based on given coordinates.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
float xX coordinate to translate.
float yY coordinate to translate.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Rotate()

Image_ErrorCode OH_PixelmapNative_Rotate(OH_PixelmapNative *pixelmap, float angle)

Description

Rotates a PixelMap based on a given angle.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
float angleImage rotation angle, in degrees.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Flip()

Image_ErrorCode OH_PixelmapNative_Flip(OH_PixelmapNative *pixelmap, bool shouldFlipHorizontally, bool shouldFlipVertically)

Description

Flips a PixelMap based on a given angle.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
bool shouldFlipHorizontallyWhether to flip the image horizontally. true to flip the image horizontally, false otherwise.
bool shouldFlipVerticallyWhether to flip the image vertically. true to flip the image vertically, false otherwise.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Crop()

Image_ErrorCode OH_PixelmapNative_Crop(OH_PixelmapNative *pixelmap, Image_Region *region)

Description

Crops a PixelMap based on a given size.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
Image_Region *regionPointer to the region of the image after cropping.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Release()

Image_ErrorCode OH_PixelmapNative_Release(OH_PixelmapNative *pixelmap)

Description

Releases the pointer to an OH_PixelmapNative object. OH_PixelmapNative_Destroy is recommended.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_Destroy()

Image_ErrorCode OH_PixelmapNative_Destroy(OH_PixelmapNative **pixelmap)

Description

Releases the pointer to an OH_PixelmapNative object.

Since: 18

Parameters

NameDescription
OH_PixelmapNative **pixelmapPointer to an OH_PixelmapNative object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_ConvertAlphaFormat()

Image_ErrorCode OH_PixelmapNative_ConvertAlphaFormat(OH_PixelmapNative* srcpixelmap, OH_PixelmapNative* dstpixelmap, const bool isPremul)

Description

Converts pixel data of a PixelMap from premultiplied alpha to non-premultiplied alpha, or vice versa.

Since: 12

Parameters

NameDescription
OH_PixelmapNative* srcpixelmapPointer to the source PixelMap, which is an OH_PixelmapNative object.
OH_PixelmapNative* dstpixelmapPointer to the destination PixelMap, which is an OH_PixelmapNative object.
const bool isPremulConversion mode. The value true means a conversion from premultiplied alpha to non-premultiplied alpha, and false means a conversion from non-premultiplied alpha to premultiplied alpha.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_CreateEmptyPixelmap()

Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmap(OH_Pixelmap_InitializationOptions *options, OH_PixelmapNative **pixelmap)

Description

Creates an empty PixelMap object based on OH_Pixelmap_InitializationOptions. The memory data is 0.

Since: 12

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to the properties.
OH_PixelmapNative **pixelmapDouble pointer to the OH_PixelmapNative object created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator()

Image_ErrorCode OH_PixelmapNative_CreateEmptyPixelmapUsingAllocator(OH_Pixelmap_InitializationOptions *options, IMAGE_ALLOCATOR_MODE allocator, OH_PixelmapNative **pixelmap)

Description

Creates an empty PixelMap object based on the options and memory type, where allocator specifies the memory type of the PixelMap. By default, the system selects an appropriate memory type based on the image type, image size, and platform capability. When processing the returned PixelMap object, consider the impact of stride.

Since: 20

Parameters

NameDescription
OH_Pixelmap_InitializationOptions *optionsPointer to the options used for creating the PixelMap.
IMAGE_ALLOCATOR_MODE allocatorType of memory allocation for the PixelMap.
OH_PixelmapNative **pixelmapDouble pointer to the OH_PixelmapNative object created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported.
IMAGE_TOO_LARGE: The image is too large to allocate memory.
IMAGE_DMA_OPERATION_FAILED: The DMA memory operation fails.
IMAGE_ALLOCATOR_MODE_UNSUPPORTED: The current memory allocation type is not supported, for example, creating an HDR image using shared memory.

OH_PixelmapNative_CreatePixelmapFromSurface()

Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromSurface(const char *surfaceId, size_t length, OH_PixelmapNative **pixelmap)

Description

Creates a PixelMap from a surface with the specified surface ID.

Since: 22

Parameters

NameDescription
const char *surfaceIdPointer to the string of the surface ID.
size_t lengthLength of the surface ID string.
OH_PixelmapNative **pixelmapDouble pointer to the PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, surfaceId or pixelmap is incorrect.
IMAGE_CREATE_PIXELMAP_FAILED: Creating the PixelMap fails.

OH_PixelmapNative_CreatePixelmapFromSurfaceWithTransformation()

Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromSurfaceWithTransformation(const char *surfaceId, size_t length, bool transformEnabled, OH_PixelmapNative **pixelmap)

Description

Creates a PixelMap object for previewing a stream based on a surface ID. The surface may carry rotation or flipping information.

Since: 23

Parameters

NameDescription
const char *surfaceIdSurface ID.
size_t lengthLength of the surface ID.
bool transformEnabledWhether to perform inverse transformation on the surface that carries transformation information to eliminate the rotation or flipping effect of the PixelMap. If the surface does not carry transformation information, this parameter does not take effect.
If this parameter is set to true, the inverse transformation is performed. The transform angle matches the angle carried by the surface but in the opposite direction, and the output PixelMap has no rotation or flipping effect.
If this parameter is set to false, no inverse transformation is performed. The output PixelMap has the rotation or flipping effect based on the transformation information in the surface.
OH_PixelmapNative **pixelmapDouble pointer to the PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_INVALID_PARAMETER: Invalid parameters. For example, surfaceId or pixelmap is incorrect.
IMAGE_UNSUPPORTED_OPERATION: The operation is not supported. For example, the operation is called across platforms.
IMAGE_GET_IMAGE_DATA_FAILED: Failed to obtain the surface data.
IMAGE_CREATE_PIXELMAP_FAILED: Creating the PixelMap fails.

Reference

OH_PixelmapNative

OH_PixelmapNative_CreatePixelmapFromNativeBuffer()

Image_ErrorCode OH_PixelmapNative_CreatePixelmapFromNativeBuffer(OH_NativeBuffer *nativeBuffer, OH_PixelmapNative **pixelmap)

Description

Creates a PixelMap using a NativeBuffer. If the CPU access permission is not configured for the NativeBuffer, the PixelMap cannot be created.
The supported pixel formats are RGBA_8888, NV21, NV12, YCBCR_P010, and YCRCB_P010.

Since: 22

Parameters

NameDescription
OH_NativeBuffer *nativeBufferPointer to the NativeBuffer object that contains PixelMap data.
OH_PixelmapNative **pixelmapDouble pointer to the PixelMap created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: The parameter is invalid. For example, nativeBuffer or pixelmap is incorrect, the pixel format is not supported, or the CPU access permission is not configured.
IMAGE_CREATE_PIXELMAP_FAILED: Creating the PixelMap fails.

OH_PixelmapNative_GetNativeBuffer()

Image_ErrorCode OH_PixelmapNative_GetNativeBuffer(OH_PixelmapNative *pixelmap, OH_NativeBuffer **nativeBuffer)

Description

Obtains the NativeBuffer object from a PixelMap in the DMA memory.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the PixelMap.
OH_NativeBuffer **nativeBufferDouble pointer to the NativeBuffer object obtained.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DMA_NOT_EXIST: DMA memory does not exist.
IMAGE_DMA_OPERATION_FAILED: The DMA memory operation fails.

OH_PixelmapNative_GetMetadata()

Image_ErrorCode OH_PixelmapNative_GetMetadata(OH_PixelmapNative *pixelmap, OH_Pixelmap_HdrMetadataKey key, OH_Pixelmap_HdrMetadataValue **value)

Description

Obtains the metadata.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
OH_Pixelmap_HdrMetadataKey keyHDR metadata key.
OH_Pixelmap_HdrMetadataValue **valueDouble pointer to the value of the metadata key.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DMA_NOT_EXIST: DMA memory does not exist.
IMAGE_COPY_FAILED: Memory copy fails.

OH_PixelmapNative_SetMetadata()

Image_ErrorCode OH_PixelmapNative_SetMetadata(OH_PixelmapNative *pixelmap, OH_Pixelmap_HdrMetadataKey key, OH_Pixelmap_HdrMetadataValue *value)

Description

Sets the metadata.

Since: 12

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
OH_Pixelmap_HdrMetadataKey keyHDR metadata key.
OH_Pixelmap_HdrMetadataValue *valuePointer to the value of the metadata key.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DMA_NOT_EXIST: DMA memory does not exist.
IMAGE_COPY_FAILED: Memory copy fails.

OH_PixelmapNative_SetColorSpaceNative()

Image_ErrorCode OH_PixelmapNative_SetColorSpaceNative(OH_PixelmapNative *pixelmap, OH_NativeColorSpaceManager *colorSpaceNative)

Description

Sets a NativeColorSpaceManager object.

Since: 13

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the target PixelMap of the NativeColorSpaceManager object.
OH_NativeColorSpaceManager *colorSpaceNativePointer to a NativeColorSpaceManager object.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_GetColorSpaceNative()

Image_ErrorCode OH_PixelmapNative_GetColorSpaceNative(OH_PixelmapNative *pixelmap, OH_NativeColorSpaceManager **colorSpaceNative)

Description

Obtains a NativeColorSpaceManager object.

Since: 13

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the source PixelMap of the NativeColorSpaceManager.
OH_NativeColorSpaceManager **colorSpaceNativeDouble pointer to the NativeColorSpaceManager object obtained.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PixelmapNative_SetMemoryName()

Image_ErrorCode OH_PixelmapNative_SetMemoryName(OH_PixelmapNative *pixelmap, char *name, size_t *size)

Description

Sets the memory name of a PixelMap.

Since: 13

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to an OH_PixelmapNative object.
char *namePointer to the memory name.
size_t *sizePointer to the memory size (in bytes).

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: The name length exceeds the value range. The name length for DMA memory settings should be within the range of 1 to 255 bytes. For ASHMEM memory settings, the name length should be within the range of 1 to 244 bytes.
IMAGE_UNSUPPORTED_MEMORY_FORMAT: The memory is neither DMA memory nor ASHMEM memory.

OH_PixelmapNative_GetByteCount()

Image_ErrorCode OH_PixelmapNative_GetByteCount(OH_PixelmapNative *pixelmap, uint32_t *byteCount)

Description

Obtains the total number of bytes occupied by all pixels in a PixelMap, excluding any memory padding.

Since: 18

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to a PixelMap.
uint32_t *byteCountPointer to the number of bytes obtained.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
Image_BAD_PARAMETER: The pixelmap or byteCount parameter is invalid.

OH_PixelmapNative_GetAllocationByteCount()

Image_ErrorCode OH_PixelmapNative_GetAllocationByteCount(OH_PixelmapNative *pixelmap, uint32_t *allocationByteCount)

Description

Obtains the number of bytes in the memory allocated by a PixelMap to store pixels.

Since: 18

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to a PixelMap.
uint32_t *allocationByteCountPointer to the number of bytes obtained.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
Image_BAD_PARAMETER: The pixelmap or allocationByteCount parameter is invalid.

OH_PixelmapNative_AccessPixels()

Image_ErrorCode OH_PixelmapNative_AccessPixels(OH_PixelmapNative *pixelmap, void **addr)

Description

Obtains the memory address where the pixels of a PixelMap are stored and locks the memory.
When the memory is locked, any attempts to alter or free the pixel data of the PixelMap will fail or be ineffective.

Since: 15

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to a PixelMap.
void **addrDouble pointer to the memory address.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
Image_BAD_PARAMETER: The pixelmap or addr parameter is invalid.
Image_LOCK_UNLOCK_FAILED: Memory locking fails.

OH_PixelmapNative_UnaccessPixels()

Image_ErrorCode OH_PixelmapNative_UnaccessPixels(OH_PixelmapNative *pixelmap)

Description

Unlocks the memory allocated to store the pixels of a PixelMap.
This function must be used together with OH_PixelmapNative_AccessPixels.

Since: 15

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to a PixelMap.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
Image_BAD_PARAMETER: The pixelmap parameter is invalid.
IMAGE_LOCK_UNLOCK_FAILED: Memory unlocking fails.

OH_PixelmapNative_GetUniqueId()

Image_ErrorCode OH_PixelmapNative_GetUniqueId(OH_PixelmapNative *pixelmap, uint32_t *uniqueId)

Description

Obtains the unique ID of a PixelMap.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the PixelMap.
uint32_t *uniqueIdPointer to the unique ID obtained.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, pixelmap or uniqueId is incorrect.

OH_PixelmapNative_IsReleased()

Image_ErrorCode OH_PixelmapNative_IsReleased(OH_PixelmapNative *pixelmap, bool *released)

Description

Checks whether a PixelMap is released. If released, any attempt to access the internal data of this object will fail.

Since: 22

Parameters

NameDescription
OH_PixelmapNative *pixelmapPointer to the PixelMap.
bool *releasedRelease status of the PixelMap. The value true indicates that the PixelMap is released, and false indicates the opposite.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: Invalid parameters. For example, pixelmap or released is incorrect.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-image-nativemodule-oh-pixelmap-hdrmetadatavalue

openharmony 鸿蒙 capi-image-imagepacker-opts-

openharmony 鸿蒙 capi-image-nativemodule-image-region

openharmony 鸿蒙 capi-image-imagepacker-native-

openharmony 鸿蒙 capi-image-imagenative-

openharmony 鸿蒙 capi-image-processing-h

openharmony 鸿蒙 capi-image-ohosimagesourcesupportedformat

openharmony 鸿蒙 capi-image-nativemodule-image-size

openharmony 鸿蒙 capi-image-mdk-h

openharmony 鸿蒙 capi-image-ohosimagesourcedelaytimelist

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/QtiJ6bOY