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
| Name | typedef Keyword | Description |
|---|---|---|
| OhosPixelMapInfo | - | Describes the information about a PixelMap. |
Enums
| Name | Description |
|---|---|
| Error Codes Returned by Functions | Enumerates the error codes returned by the functions. |
| Pixel Formats | Enumerates the pixel formats. |
| anonymous enum | Enumerates the PixelMap scale modes. |
Functions
| Name | Description |
|---|---|
| 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 Item | Description |
|---|---|
| OHOS_IMAGE_RESULT_SUCCESS = 0 | Operation success. |
| OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 | Invalid value. |
Pixel Formats
enum anonymous enum
Description
Enumerates the pixel formats.
Since: 8
Deprecated from: 10
| Enum Item | Description |
|---|---|
| OHOS_PIXEL_MAP_FORMAT_NONE = 0 | Unknown format. |
| OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3 | RGBA_8888 format. |
| OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 | RGB_565 format. |
PixelMap Scale Modes
enum anonymous enum
Description
Enumerates the PixelMap scale modes.
Since: 10
| Enum Item | Description |
|---|---|
| OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0 | Adapting to the target image size. |
| OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 | Cropping 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
| Name | Description |
|---|---|
| napi_env env | Pointer to the NAPI environment. |
| napi_value value | PixelMap object at the application layer. |
| OhosPixelMapInfo *info | Pointer to the object that stores the information obtained. |
Returns
| Type | Description |
|---|---|
| int32_t | One 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
| Name | Description |
|---|---|
| napi_env env | Pointer to the NAPI environment. |
| napi_value value | PixelMap object at the application layer. |
| void** addrPtr | Double pointer to the memory address. |
Returns
| Type | Description |
|---|---|
| int32_t | One 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
| Name | Description |
|---|---|
| napi_env env | Pointer to the NAPI environment. |
| napi_value value | PixelMap object at the application layer. |
Returns
| Type | Description |
|---|---|
| int32_t | One 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