openharmony 鸿蒙 capi-image-pixel-map-napi-h

2026-08-25 浏览 (1)

image_pixel_map_napi.h

Overview

The file declares the APIs used to lock, access, and unlock a PixelMap.

Library: libpixelmap_ndk.z.so

System capability: SystemCapability.Multimedia.Image.Core

File to include: <multimedia/image_framework/image_pixel_map_napi.h>

Since: 8

Related module: Image

Summary

Structs

Nametypedef KeywordDescription
OhosPixelMapInfo-Describes the information about a PixelMap.

Enums

NameDescription
Error Codes Returned by FunctionsEnumerates the error codes returned by the functions.
Pixel FormatsEnumerates the pixel formats.
anonymous enumEnumerates the PixelMap scale modes.

Functions

NameDescription
int32_t OH_GetImageInfo(napi_env env, napi_value value, OhosPixelMapInfo *info)Obtains the information about a PixelMap object and stores the information to the OhosPixelMapInfo struct.
int32_t OH_AccessPixels(napi_env env, napi_value value, void** addrPtr)Obtains the memory address of a PixelMap object and locks the memory.
*addrPtr is the memory address obtained. After finishing the access, you must use OH_UnAccessPixels to unlock the memory. Then the memory cannot be accessed or operated.
int32_t OH_UnAccessPixels(napi_env env, napi_value value)Unlocks the memory of a PixelMap object. This function is used with OH_AccessPixels in pairs.

Enum Description

Error Codes Returned by Functions

enum anonymous enum

Description

Enumerates the error codes returned by the functions.

Since: 8

Deprecated from: 10

Enum ItemDescription
OHOS_IMAGE_RESULT_SUCCESS = 0Operation success.
OHOS_IMAGE_RESULT_BAD_PARAMETER = -1Invalid value.

Pixel Formats

enum anonymous enum

Description

Enumerates the pixel formats.

Since: 8

Deprecated from: 10

Enum ItemDescription
OHOS_PIXEL_MAP_FORMAT_NONE = 0Unknown format.
OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3RGBA_8888 format.
OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2RGB_565 format.

PixelMap Scale Modes

enum anonymous enum

Description

Enumerates the PixelMap scale modes.

Since: 10

Enum ItemDescription
OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0Adapting to the target image size.
OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1Cropping the center portion of an image to the target size.

Function Description

OH_GetImageInfo()

int32_t OH_GetImageInfo(napi_env env, napi_value value, OhosPixelMapInfo *info)

Description

Obtains the information about a PixelMap object and stores the information to the OhosPixelMapInfo struct.

Since: 8

Deprecated from: 10

Parameters

NameDescription
napi_env envPointer to the NAPI environment.
napi_value valuePixelMap object at the application layer.
OhosPixelMapInfo *infoPointer to the object that stores the information obtained.

Returns

TypeDescription
int32_tOne of the following error codes:
OHOS_IMAGE_RESULT_SUCCESS: The operation is successful.
OHOS_IMAGE_RESULT_BAD_PARAMETER: The operation fails.

OH_AccessPixels()

int32_t OH_AccessPixels(napi_env env, napi_value value, void** addrPtr)

Description

Obtains the memory address of a PixelMap object and locks the memory.

*addrPtr is the memory address obtained. After finishing the access, you must use OH_UnAccessPixels to unlock the memory. Then the memory cannot be accessed or operated.

Since: 8

Deprecated from: 10

Parameters

NameDescription
napi_env envPointer to the NAPI environment.
napi_value valuePixelMap object at the application layer.
void** addrPtrDouble pointer to the memory address.

Returns

TypeDescription
int32_tOne of the following error codes:
OHOS_IMAGE_RESULT_SUCCESS: The operation is successful.
OHOS_IMAGE_RESULT_BAD_PARAMETER: The operation fails.

OH_UnAccessPixels()

int32_t OH_UnAccessPixels(napi_env env, napi_value value)

Description

Unlocks the memory of a PixelMap object. This function is used with OH_AccessPixels in pairs.

Since: 8

Deprecated from: 10

Parameters

NameDescription
napi_env envPointer to the NAPI environment.
napi_value valuePixelMap object at the application layer.

Returns

TypeDescription
int32_tOne of the following error codes:
OHOS_IMAGE_RESULT_SUCCESS: The operation is successful.
OHOS_IMAGE_RESULT_BAD_PARAMETER: The operation fails.

你可能感兴趣的鸿蒙文章

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/aVJfQFmA