image_pixel_map_napi.h

Overview

Declares the APIs that can lock, access, and unlock pixel map data.

Since: 8

Related Modules:

Image

Summary

Structs

Name Description
OhosPixelMapInfo Defines the pixel map information.
OhosPixelMapCreateOps Defines the options used for creating a pixel map.

Types

Name Description
NativePixelMap Defines the data type name of the native pixel map.

Enums

Name Description
{ OHOS_IMAGE_RESULT_SUCCESS = 0, OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } Enumerates the error codes returned by a function.
{ OHOS_PIXEL_MAP_FORMAT_NONE = 0, OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3, OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } Enumerates the pixel formats.
{ OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } Enumerates the pixel map alpha types.
{ OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0, OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } Enumerates the pixel map scale modes.
{ OHOS_PIXEL_MAP_READ_ONLY = 0, OHOS_PIXEL_MAP_EDITABLE = 1 } Enumerates the pixel map editing types.

Functions

Name Description
OH_GetImageInfo (napi_env env, napi_value value, OhosPixelMapInfo *info) Obtains the PixelMap information and stores the information to the OhosPixelMapInfo structure.
OH_AccessPixels (napi_env env, napi_value value, void **addrPtr) Obtains the memory address of the PixelMap object data and locks the memory.
OH_UnAccessPixels (napi_env env, napi_value value) Unlocks the memory of the PixelMap object data. This function is used with OH_AccessPixels in pairs.

Variables

Name Description
width Image width, in pixels.
height Image height, in pixels.
pixelFormat Image format.
editable Editing type of the image.
alphaType Alpha type of the image.
scaleMode Scale mode of the image.

Variable Description

alphaType

uint32_t alphaType

Description: Alpha type of the image.

editable

uint32_t editable

Description: Editing type of the image.

height

uint32_t height

Description: Image height, in pixels.

pixelFormat

int32_t pixelFormat

Description: Image format.

scaleMode

uint32_t scaleMode

Description: Scale mode of the image.

width

uint32_t width

Description: Image width, in pixels.