• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Image
2
3
4## Overview
5
6The **Image** module enables access to image APIs.
7
8**System capability**: SystemCapability.Multimedia.Image
9
10**Since**: 8
11
12
13## Summary
14
15
16### Files
17
18| Name| Description|
19| -------- | -------- |
20| [image_mdk.h](image__mdk_8h.md) | Declares the APIs used to access the image rectangle, size, format, and component data.<br>**File to include**: &lt;multimedia/image_framework/image_mdk.h&gt;<br>**Library**: libimage_ndk.z.so|
21| [image_mdk_common.h](image__mdk__common_8h.md) | Declares the common enums and structs used by the image APIs.<br>**File to include**: &lt;multimedia/image_framework/image_mdk_common.h&gt;<br>**Library**: libimage_ndk.z.so|
22| [image_packer_mdk.h](image__packer__mdk_8h.md) | Declares the APIs used to pack an image into a buffer or file.<br>**File to include**: &lt;multimedia/image_framework/image_packer_mdk.h&gt;<br>**Library**:|
23| [image_pixel_map_mdk.h](image__pixel__map__mdk_8h.md) | Declares the APIs used to lock, access, and unlock a pixel map.<br>**File to include**: &lt;multimedia/image_framework/image_pixel_map_mdk.h&gt;<br>**Library**: libpixelmap_ndk.z.so|
24| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | (Deprecated) Declares the APIs used to lock, access, and unlock a pixel map.<br>**File to include**: &lt;multimedia/image_framework/image_pixel_map_napi.h&gt;<br>**Library**: libpixelmap_ndk.z.so|
25| [image_receiver_mdk.h](image__receiver__mdk_8h.md) | Declares the APIs used to obtain image data from the native layer.<br>**File to include**: &lt;multimedia/image_framework/image_receiver_mdk.h&gt;<br>**Library**: libimage_receiver_ndk.z.so|
26| [image_source_mdk.h](image__source__mdk_8h.md) | Declares the APIs used to decode an image source into a pixel map.<br>**File to include**: &lt;multimedia/image_framework/image_source_mdk.h&gt;<br>**Library**: libimage_source_ndk.z.so|
27
28
29### Structs
30
31| Name| Description|
32| -------- | -------- |
33| [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) | Defines the information about an image rectangle.|
34| [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) | Defines the information about an image component.|
35| [OhosImageSize](_ohos_image_size.md) | Defines the image size.|
36| [ImagePacker_Opts_](_image_packer___opts__.md) | Defines the image packing options.|
37| [OhosPixelMapInfos](_ohos_pixel_map_infos.md) | Defines the information about a pixel map.|
38| [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) | Defines the options for creating a pixel map.|
39| [OHOS::Media::OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) | Defines the information about a pixel map.|
40| [OhosImageReceiverInfo](_ohos_image_receiver_info.md) | Defines the information about an image receiver.|
41| [OhosImageRegion](_ohos_image_region.md) | Defines the region of an image source to decode.|
42| [OhosImageSourceOps](_ohos_image_source_ops.md) | Defines the image source options.|
43| [OhosImageDecodingOps](_ohos_image_decoding_ops.md) | Defines the options for decoding an image source.|
44| [OhosImageSourceInfo](_ohos_image_source_info.md) | Defines the information about an image source.|
45| [OhosImageSource](_ohos_image_source.md) | Defines the input resource of an image source. Only one type of resource is accepted at a time.|
46| [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) | Defines the delay time list of an image source.|
47| [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md) | Defines the format string supported by an image source.|
48| [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) | Defines the format string list supported by an image source.|
49| [OhosImageSourceProperty](_ohos_image_source_property.md) | Defines the property string (in key-value format) of an image source.|
50| [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) | Defines the update data of an image source.|
51
52
53### Types
54
55| Name| Description|
56| -------- | -------- |
57| [ImageNative](#imagenative) | Defines an image object at the native layer.|
58| [IRNdkErrCode](#irndkerrcode) | Defines an enum that enumerates the return values that may be used by the interface.|
59| [ImagePacker_Native](#imagepacker_native) | Defines an image packer object at the native layer.|
60| [ImagePacker_Opts](#imagepacker_opts) | Defines the alias of the image packing options.|
61| [NativePixelMap](#nativepixelmap) | Defines the data type name of the pixel map at the native layer.|
62| [OhosPixelMapInfos](#ohospixelmapinfos) | Defines the information about a pixel map.|
63| [ImageReceiverNative](#imagereceivernative) | Defines the data type name of the image receiver at the native layer.|
64| (\*[OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback)) () | Defines the callbacks for the image interface at the native layer.|
65| [ImageSourceNative](#imagesourcenative) | Defines an image source object at the native layer.|
66
67### Macros
68
69| Name| Description|
70| -------- | -------- |
71| **IMAGE_RESULT_BASE** 62980096 | Defines the basic value returned by the interface. |
72
73### Enums
74
75| Name| Description|
76| -------- | -------- |
77| { OHOS_IMAGE_FORMAT_YCBCR_422_SP = 1000,<br>OHOS_IMAGE_FORMAT_JPEG = 2000 } | Enumerates the image formats.|
78| { OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y = 1,<br>OHOS_IMAGE_COMPONENT_FORMAT_YUV_U = 2,<br>OHOS_IMAGE_COMPONENT_FORMAT_YUV_V = 3,<br>OHOS_IMAGE_COMPONENT_FORMAT_JPEG = 4 } | Enumerates the image components.|
79| [IRNdkErrCode](#irndkerrcode-1) {<br>IMAGE_RESULT_SUCCESS = 0, IMAGE_RESULT_BAD_PARAMETER = -1,<br>IMAGE_RESULT_IMAGE_RESULT_BASE = IMAGE_RESULT_BASE,<br>IMAGE_RESULT_ERR_IPC = IMAGE_RESULT_BASE + 1,<br>IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST = IMAGE_RESULT_BASE + 2,<br>IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL = IMAGE_RESULT_BASE + 3,<br>IMAGE_RESULT_DECODE_ABNORMAL = IMAGE_RESULT_BASE + 4,<br>IMAGE_RESULT_DATA_ABNORMAL = IMAGE_RESULT_BASE + 5,<br>IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6,<br>IMAGE_RESULT_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 7,<br>IMAGE_RESULT_INIT_ABNORMAL = IMAGE_RESULT_BASE + 8,<br>IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9,<br>IMAGE_RESULT_TOO_LARGE = IMAGE_RESULT_BASE + 10,<br>IMAGE_RESULT_TRANSFORM = IMAGE_RESULT_BASE + 11,<br>IMAGE_RESULT_COLOR_CONVERT = IMAGE_RESULT_BASE + 12,<br>IMAGE_RESULT_CROP = IMAGE_RESULT_BASE + 13,<br>IMAGE_RESULT_SOURCE_DATA = IMAGE_RESULT_BASE + 14,<br>IMAGE_RESULT_SOURCE_DATA_INCOMPLETE = IMAGE_RESULT_BASE + 15,<br>IMAGE_RESULT_MISMATCHED_FORMAT = IMAGE_RESULT_BASE + 16,<br>IMAGE_RESULT_UNKNOWN_FORMAT = IMAGE_RESULT_BASE + 17,<br>IMAGE_RESULT_SOURCE_UNRESOLVED = IMAGE_RESULT_BASE + 18,<br>IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19,<br>IMAGE_RESULT_DECODE_FAILED = IMAGE_RESULT_BASE + 20,<br>IMAGE_RESULT_PLUGIN_REGISTER_FAILED = IMAGE_RESULT_BASE + 21,<br>IMAGE_RESULT_PLUGIN_CREATE_FAILED = IMAGE_RESULT_BASE + 22,<br>IMAGE_RESULT_ENCODE_FAILED = IMAGE_RESULT_BASE + 23,<br>IMAGE_RESULT_ADD_PIXEL_MAP_FAILED = IMAGE_RESULT_BASE + 24,<br>IMAGE_RESULT_HW_DECODE_UNSUPPORT = IMAGE_RESULT_BASE + 25,<br>IMAGE_RESULT_DECODE_HEAD_ABNORMAL = IMAGE_RESULT_BASE + 26,<br>IMAGE_RESULT_DECODE_EXIF_UNSUPPORT = IMAGE_RESULT_BASE + 27,<br>IMAGE_RESULT_PROPERTY_NOT_EXIST = IMAGE_RESULT_BASE + 28,<br>IMAGE_RESULT_MEDIA_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 30,<br>IMAGE_RESULT_MEDIA_TOO_LARGE = IMAGE_RESULT_BASE + 31,<br>IMAGE_RESULT_MEDIA_MALLOC_FAILED = IMAGE_RESULT_BASE + 32,<br>IMAGE_RESULT_MEDIA_END_OF_STREAM = IMAGE_RESULT_BASE + 33,<br>IMAGE_RESULT_MEDIA_IO_ABNORMAL = IMAGE_RESULT_BASE + 34,<br>IMAGE_RESULT_MEDIA_MALFORMED = IMAGE_RESULT_BASE + 35,<br>IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL = IMAGE_RESULT_BASE + 36,<br>IMAGE_RESULT_MEDIA_OUT_OF_RANGE = IMAGE_RESULT_BASE + 37,<br>IMAGE_RESULT_MEDIA_STATUS_ABNORMAL = IMAGE_RESULT_BASE + 38,<br>IMAGE_RESULT_MEDIA_VALUE_INVALID = IMAGE_RESULT_BASE + 39,<br>IMAGE_RESULT_MEDIA_NULL_POINTER = IMAGE_RESULT_BASE + 40,<br>IMAGE_RESULT_MEDIA_INVALID_OPERATION = IMAGE_RESULT_BASE + 41,<br>IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT = IMAGE_RESULT_BASE + 42,<br>IMAGE_RESULT_MEDIA_EARLY_PREPARE = IMAGE_RESULT_BASE + 43,<br>IMAGE_RESULT_MEDIA_SEEK_ERR = IMAGE_RESULT_BASE + 44,<br>IMAGE_RESULT_MEDIA_PERMISSION_DENIED = IMAGE_RESULT_BASE + 45,<br>IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46,<br>IMAGE_RESULT_MEDIA_TIMED_OUT = IMAGE_RESULT_BASE + 47,<br>IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED = IMAGE_RESULT_BASE + 48,<br>IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED = IMAGE_RESULT_BASE + 49,<br>IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL = IMAGE_RESULT_BASE + 50,<br>IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL = IMAGE_RESULT_BASE + 51,<br>IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER = IMAGE_RESULT_BASE + 52,<br>IMAGE_RESULT_MEDIA_INVALID_PARAM = IMAGE_RESULT_BASE + 53,<br>IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 54,<br>IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED = IMAGE_RESULT_BASE + 55,<br>IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 56,<br>IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED = IMAGE_RESULT_BASE + 57,<br>IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST = IMAGE_RESULT_BASE + 58,<br>IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST = IMAGE_RESULT_BASE + 59,<br>IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST = IMAGE_RESULT_BASE + 60,<br>IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED = IMAGE_RESULT_BASE + 61,<br>IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR = IMAGE_RESULT_BASE + 62,<br>IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT = IMAGE_RESULT_BASE + 63,<br>IMAGE_RESULT_MEDIA_SOURCE_NOT_SET = IMAGE_RESULT_BASE + 64,<br>IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 65,<br>IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 66,<br>IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT = IMAGE_RESULT_BASE + 67,<br>IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT = IMAGE_RESULT_BASE + 68,<br>IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID = IMAGE_RESULT_BASE + 69,<br>IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND = IMAGE_RESULT_BASE + 70,<br>IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX = IMAGE_RESULT_BASE + 71,<br>IMAGE_RESULT_MEDIA_SET_VOLUME = IMAGE_RESULT_BASE + 72,<br>IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW = IMAGE_RESULT_BASE + 73,<br>IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED = IMAGE_RESULT_BASE + 74,<br>IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 75,<br>IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 76,<br>IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 150,<br>IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 151,<br>IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY = IMAGE_RESULT_BASE + 152,<br>IMAGE_RESULT_MEDIA_CONFIG_FAILED = IMAGE_RESULT_BASE + 153,<br>IMAGE_RESULT_JNI_ENV_ABNORMAL = IMAGE_RESULT_BASE + 154,<br>IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED = IMAGE_RESULT_BASE + 155,<br>IMAGE_RESULT_CREATE_SURFACE_FAILED = IMAGE_RESULT_BASE + 156,<br>IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157,<br>IMAGE_RESULT_GET_SURFACE_FAILED = IMAGE_RESULT_BASE + 158,<br>IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED = IMAGE_RESULT_BASE + 159,<br>IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED = IMAGE_RESULT_BASE + 160,<br>IMAGE_RESULT_REGISTER_LISTENER_FAILED = IMAGE_RESULT_BASE + 161,<br>IMAGE_RESULT_REGISTER_BUFFER_FAILED = IMAGE_RESULT_BASE + 162,<br>IMAGE_RESULT_FREAD_FAILED = IMAGE_RESULT_BASE + 163,<br>IMAGE_RESULT_PEEK_FAILED = IMAGE_RESULT_BASE + 164,<br>IMAGE_RESULT_SEEK_FAILED = IMAGE_RESULT_BASE + 165,<br>IMAGE_RESULT_STREAM_SIZE_ERROR = IMAGE_RESULT_BASE + 166,<br>IMAGE_RESULT_FILE_FD_ERROR = IMAGE_RESULT_BASE + 167,<br>IMAGE_RESULT_FILE_DAMAGED = IMAGE_RESULT_BASE + 168,<br>IMAGE_RESULT_CREATE_DECODER_FAILED = IMAGE_RESULT_BASE + 169,<br>IMAGE_RESULT_CREATE_ENCODER_FAILED = IMAGE_RESULT_BASE + 170,<br>IMAGE_RESULT_CHECK_FORMAT_ERROR = IMAGE_RESULT_BASE + 171,<br>IMAGE_RESULT_THIRDPART_SKIA_ERROR = IMAGE_RESULT_BASE + 172,<br>IMAGE_RESULT_HW_DECODE_FAILED = IMAGE_RESULT_BASE + 173,<br>IMAGE_RESULT_ALLOCATER_TYPE_ERROR = IMAGE_RESULT_BASE + 174,<br>IMAGE_RESULT_ALPHA_TYPE_ERROR = IMAGE_RESULT_BASE + 175,<br>IMAGE_RESULT_INDEX_INVALID = IMAGE_RESULT_BASE + 176,<br>IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200<br>} | Enumerates the return values that may be used by the interface.|
80| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types.|
81| { OHOS_PIXEL_MAP_READ_ONLY = 0,<br>OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types.|
82| { OHOS::Media::OHOS_IMAGE_RESULT_SUCCESS = 0,<br>OHOS::Media::OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.|
83| { OHOS::Media::OHOS_PIXEL_MAP_FORMAT_NONE = 0,<br>OHOS::Media::OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3,<br>OHOS::Media::OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel map formats.|
84| { OHOS::Media::OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0,<br>OHOS::Media::OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes.|
85
86
87### Functions
88
89| Name| Description|
90| -------- | -------- |
91| [OH_Image_InitImageNative](#oh_image_initimagenative) (napi_env env, napi_value source) | Converts an **Image** object at the JavaScript native layer into an **ImageNative** object.|
92| [OH_Image_ClipRect](#oh_image_cliprect) (const [ImageNative](#imagenative) \*native, struct [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) \*rect) | Obtains [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) of an **ImageNative** object.|
93| [OH_Image_Size](#oh_image_size) (const [ImageNative](#imagenative) \*native, struct [OhosImageSize](_ohos_image_size.md) \*size) | Obtains [OhosImageSize](_ohos_image_size.md) of an **ImageNative** object.|
94| [OH_Image_Format](#oh_image_format) (const [ImageNative](#imagenative) \*native, int32_t \*format) | Obtains the format of an **ImageNative** object.|
95| [OH_Image_GetComponent](#oh_image_getcomponent) (const [ImageNative](#imagenative) \*native, int32_t componentType, struct [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) \*componentNative) | Obtains [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) of an **ImageNative** object.|
96| [OH_Image_Release](#oh_image_release) ([ImageNative](#imagenative) \*native) | Releases an **ImageNative** object.|
97| [OH_ImagePacker_Create](#oh_imagepacker_create) (napi_env env, napi_value \*res) | Obtains an **ImagePacker** object at the JavaScript native layer.|
98| [OH_ImagePacker_InitNative](#oh_imagepacker_initnative) (napi_env env, napi_value packer) | Converts an **ImagePacker** object at the JavaScript native layer into an **ImagePacker_Native** object.|
99| [OH_ImagePacker_PackToData](#oh_imagepacker_packtodata) ([ImagePacker_Native](#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](#imagepacker_opts) \*opts, uint8_t \*outData, size_t \*size) | Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a buffer (defined by **outData**) based on the specified **ImagePacker_Opts** struct.|
100| [OH_ImagePacker_PackToFile](#oh_imagepacker_packtofile) ([ImagePacker_Native](#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](#imagepacker_opts) \*opts, int fd) | Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a file based on the specified **ImagePacker_Opts** struct.|
101| [OH_ImagePacker_Release](#oh_imagepacker_release) ([ImagePacker_Native](#imagepacker_native) \*native) | Releases an [ImagePacker_Native](#imagepacker_native) object.|
102| [OH_PixelMap_CreatePixelMap](#oh_pixelmap_createpixelmap) (napi_env env, [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) info, void \*buf, size_t len, napi_value \*res) | Creates a **PixelMap** object.|
103| [OH_PixelMap_CreateAlphaPixelMap](#oh_pixelmap_createalphapixelmap) (napi_env env, napi_value source, napi_value \*alpha) | Creates a **PixelMap** object that contains only alpha channel information.|
104| [OH_PixelMap_InitNativePixelMap](#oh_pixelmap_initnativepixelmap) (napi_env env, napi_value source) | Initializes a **PixelMap** object.|
105| [OH_PixelMap_GetBytesNumberPerRow](#oh_pixelmap_getbytesnumberperrow) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*num) | Obtains the number of bytes per row of a **NativePixelMap** object.|
106| [OH_PixelMap_GetIsEditable](#oh_pixelmap_getiseditable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*editable) | Checks whether a **NativePixelMap** object is editable.|
107| [OH_PixelMap_IsSupportAlpha](#oh_pixelmap_issupportalpha) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*alpha) | Checks whether a **NativePixelMap** object supports alpha channels.|
108| [OH_PixelMap_SetAlphaAble](#oh_pixelmap_setalphaable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t alpha) | Sets an alpha channel for a **NativePixelMap** object.|
109| [OH_PixelMap_GetDensity](#oh_pixelmap_getdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*density) | Obtains the pixel density of a **NativePixelMap** object.|
110| [OH_PixelMap_SetDensity](#oh_pixelmap_setdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t density) | Sets the pixel density for a **NativePixelMap** object.|
111| [OH_PixelMap_SetOpacity](#oh_pixelmap_setopacity) (const [NativePixelMap](#nativepixelmap) \*native, float opacity) | Sets the opacity for a **NativePixelMap** object.|
112| [OH_PixelMap_Scale](#oh_pixelmap_scale) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Scales a **NativePixelMap** object.|
113| [OH_PixelMap_Translate](#oh_pixelmap_translate) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Translates a **NativePixelMap** object.|
114| [OH_PixelMap_Rotate](#oh_pixelmap_rotate) (const [NativePixelMap](#nativepixelmap) \*native, float angle) | Rotates a **NativePixelMap** object.|
115| [OH_PixelMap_Flip](#oh_pixelmap_flip) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y) | Flips a **NativePixelMap** object.|
116| [OH_PixelMap_Crop](#oh_pixelmap_crop) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y, int32_t width, int32_t height) | Crops a **NativePixelMap** object.|
117| [OH_PixelMap_GetImageInfo](#oh_pixelmap_getimageinfo) (const [NativePixelMap](#nativepixelmap) \*native, [OhosPixelMapInfos](_ohos_pixel_map_infos.md) \*info) | Obtains the image information of a **NativePixelMap** object.|
118| [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) (const [NativePixelMap](#nativepixelmap) \*native, void \*\*addr) | Obtains the memory address of a **NativePixelMap** object and locks the memory.|
119| [OH_PixelMap_UnAccessPixels](#oh_pixelmap_unaccesspixels) (const [NativePixelMap](#nativepixelmap) \*native) | Unlocks the memory of a **NativePixelMap** object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs.|
120| [OHOS::Media::OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) \*info) | Obtains the information about a **PixelMap** object and stores the information to the [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) struct.|
121| [OHOS::Media::OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory.|
122| [OHOS::Media::OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with **OH_AccessPixels** in pairs.|
123| [OH_Image_Receiver_CreateImageReceiver](#oh_image_receiver_createimagereceiver) (napi_env env, struct [OhosImageReceiverInfo](_ohos_image_receiver_info.md) info, napi_value \*res) | Creates an **ImageReceiver** object at the application layer.|
124| [OH_Image_Receiver_InitImageReceiverNative](#oh_image_receiver_initimagereceivernative) (napi_env env, napi_value source) | Initializes an [ImageReceiverNative](#imagereceivernative) object through an **ImageReceiver** object.|
125| [OH_Image_Receiver_GetReceivingSurfaceId](#oh_image_receiver_getreceivingsurfaceid) (const [ImageReceiverNative](#imagereceivernative) \*native, char \*id, size_t len) | Obtains the receiver ID through an [ImageReceiverNative](#imagereceivernative) object.|
126| [OH_Image_Receiver_ReadLatestImage](#oh_image_receiver_readlatestimage) (const [ImageReceiverNative](#imagereceivernative) \*native, napi_value \*image) | Obtains the latest image through an [ImageReceiverNative](#imagereceivernative) object.|
127| [OH_Image_Receiver_ReadNextImage](#oh_image_receiver_readnextimage) (const [ImageReceiverNative](#imagereceivernative) \*native, napi_value \*image) | Obtains the next image through an [ImageReceiverNative](#imagereceivernative) object.|
128| [OH_Image_Receiver_On](#oh_image_receiver_on) (const [ImageReceiverNative](#imagereceivernative) \*native, [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback) | Registers an [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback. This callback is triggered whenever a new image is received.|
129| [OH_Image_Receiver_GetSize](#oh_image_receiver_getsize) (const [ImageReceiverNative](#imagereceivernative) \*native, struct [OhosImageSize](_ohos_image_size.md) \*size) | Obtains the size of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.|
130| [OH_Image_Receiver_GetCapacity](#oh_image_receiver_getcapacity) (const [ImageReceiverNative](#imagereceivernative) \*native, int32_t \*capacity) | Obtains the capacity of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.|
131| [OH_Image_Receiver_GetFormat](#oh_image_receiver_getformat) (const [ImageReceiverNative](#imagereceivernative) \*native, int32_t \*format) | Obtains the format of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.|
132| [OH_Image_Receiver_Release](#oh_image_receiver_release) ([ImageReceiverNative](#imagereceivernative) \*native) | Releases an [ImageReceiverNative](#imagereceivernative) object.|
133| [OH_ImageSource_Create](#oh_imagesource_create) (napi_env env, struct [OhosImageSource](_ohos_image_source.md) \*src, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs.|
134| [OH_ImageSource_CreateFromUri](#oh_imagesource_createfromuri) (napi_env env, char \*uri, size_t size, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.|
135| [OH_ImageSource_CreateFromFd](#oh_imagesource_createfromfd) (napi_env env, int32_t fd, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.|
136| [OH_ImageSource_CreateFromData](#oh_imagesource_createfromdata) (napi_env env, uint8_t \*data, size_t dataSize, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.|
137| [OH_ImageSource_CreateFromRawFile](#oh_imagesource_createfromrawfile) (napi_env env, RawFileDescriptor rawFile, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified raw file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.|
138| [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental) (napi_env env, struct [OhosImageSource](_ohos_image_source.md) \*source, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs.|
139| [OH_ImageSource_CreateIncrementalFromData](#oh_imagesource_createincrementalfromdata) (napi_env env, uint8_t \*data, size_t dataSize, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. The image data is updated through **OH_ImageSource_UpdateData**. |
140| [OH_ImageSource_GetSupportedFormats](#oh_imagesource_getsupportedformats) (struct [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) \*res) | Obtains all supported decoding formats.|
141| [OH_ImageSource_InitNative](#oh_imagesource_initnative) (napi_env env, napi_value source) | Converts an **ImageSource** object at the JavaScript native layer into an [ImageSourceNative](#imagesourcenative) object.|
142| [OH_ImageSource_CreatePixelMap](#oh_imagesource_createpixelmap) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageDecodingOps](_ohos_image_decoding_ops.md) \*ops, napi_value \*res) | Decodes an **ImageSourceNative** object to obtain a **PixelMap** object at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.|
143| [OH_ImageSource_CreatePixelMapList](#oh_imagesource_createpixelmaplist) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageDecodingOps](_ohos_image_decoding_ops.md) \*ops, napi_value \*res) | Decodes an **ImageSourceNative** object to obtain all **PixelMap** objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.|
144| [OH_ImageSource_GetDelayTime](#oh_imagesource_getdelaytime) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) \*res) | Obtains the delay time list from an **ImageSourceNative** object (such as GIF image source).|
145| [OH_ImageSource_GetFrameCount](#oh_imagesource_getframecount) (const [ImageSourceNative](#imagesourcenative) \*native, uint32_t \*res) | Obtains the number of frames from an **ImageSourceNative** object.|
146| [OH_ImageSource_GetImageInfo](#oh_imagesource_getimageinfo) (const [ImageSourceNative](#imagesourcenative) \*native, int32_t index, struct [OhosImageSourceInfo](_ohos_image_source_info.md) \*info) | Obtains image source information from an **ImageSourceNative** object by index.|
147| [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*key, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*value) | Obtains the value of an image property from an **ImageSourceNative** object.|
148| [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*key, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*value) | Modifies the value of an image property of an **ImageSourceNative** object.|
149| [OH_ImageSource_UpdateData](#oh_imagesource_updatedata) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) \*data) | Updates the data of an **ImageSourceNative** object.|
150| [OH_ImageSource_Release](#oh_imagesource_release) ([ImageSourceNative](#imagesourcenative) \*native) | Releases an **ImageSourceNative** object.|
151
152
153### Variables
154
155| Name| Description|
156| -------- | -------- |
157| [OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE](#ohos_image_property_bits_per_sample) = "BitsPerSample" | Defines a pointer to bits per sample, one of the image properties.|
158| [OHOS_IMAGE_PROPERTY_ORIENTATION](#ohos_image_property_orientation) = "Orientation" | Defines a pointer to the orientation, one of the image properties.|
159| [OHOS_IMAGE_PROPERTY_IMAGE_LENGTH](#ohos_image_property_image_length) = "ImageLength" | Defines a pointer to the image length, one of the image properties.|
160| [OHOS_IMAGE_PROPERTY_IMAGE_WIDTH](#ohos_image_property_image_width) = "ImageWidth" | Defines a pointer to the image width, one of the image properties.|
161| [OHOS_IMAGE_PROPERTY_GPS_LATITUDE](#ohos_image_property_gps_latitude) = "GPSLatitude" | Defines a pointer to the GPS latitude, one of the image properties.|
162| [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE](#ohos_image_property_gps_longitude) = "GPSLongitude" | Defines a pointer to the GPS longitude, one of the image properties.|
163| [OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF](#ohos_image_property_gps_latitude_ref) = "GPSLatitudeRef" | Defines a pointer to the GPS latitude reference information, one of the image properties.|
164| [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF](#ohos_image_property_gps_longitude_ref) = "GPSLongitudeRef" | Defines a pointer to the GPS longitude reference information, one of the image properties.|
165| [OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL](#ohos_image_property_date_time_original) = "DateTimeOriginal" | Defines a pointer to the created date and time, one of the image properties.|
166| [OHOS_IMAGE_PROPERTY_EXPOSURE_TIME](#ohos_image_property_exposure_time) = "ExposureTime" | Defines a pointer to the exposure time, one of the image properties.|
167| [OHOS_IMAGE_PROPERTY_SCENE_TYPE](#ohos_image_property_scene_type) = "SceneType" | Defines a pointer to the scene type, one of the image properties.|
168| [OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS](#ohos_image_property_iso_speed_ratings) = "ISOSpeedRatings" | Defines a pointer to the ISO speed ratings, one of the image properties.|
169| [OHOS_IMAGE_PROPERTY_F_NUMBER](#ohos_image_property_f_number) = "FNumber" | Defines a pointer to the f-number of the image, one of the image properties.|
170| [OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL](#ohos_image_property_compressed_bits_per_pixel) = "CompressedBitsPerPixel" | Defines a pointer to the compressed bits per pixel, one of the image properties.|
171| [OhosImageRegion::x](#x) | Defines the X coordinate of the start point, in pixels.|
172| [OhosImageRegion::y](#y) | Defines the Y coordinate of the start point, in pixels.|
173| [OhosImageRegion::width](#width) | Defines the width of the region, in pixels.|
174| [OhosImageRegion::height](#height) | Defines the height of the region, in pixels.|
175| [OhosImageSourceOps::density](#density-12) | Defines the pixel density of the image source.|
176| [OhosImageSourceOps::pixelFormat](#pixelformat-13) | Defines the pixel format of the image source. It is usually used to describe the YUV buffer.|
177| [OhosImageSourceOps::size](#size-17) | Defines the pixel width and height of the image source.|
178| [OhosImageDecodingOps::editable](#editable) | Defines whether the output pixel map is editable.|
179| [OhosImageDecodingOps::pixelFormat](#pixelformat-23) | Defines the pixel format of the output pixel map.|
180| [OhosImageDecodingOps::fitDensity](#fitdensity) | Defines the pixel density of the output pixel map.|
181| [OhosImageDecodingOps::index](#index) | Defines the index of the output pixel map.|
182| [OhosImageDecodingOps::sampleSize](#samplesize) | Defines the size of the sample.|
183| [OhosImageDecodingOps::rotate](#rotate) | Defines the decoding rotation options.|
184| [OhosImageDecodingOps::size](#size-27) | Defines the pixel width and height of the output pixel map.|
185| [OhosImageDecodingOps::region](#region) | Defines the region of the output pixel map.|
186| [OhosImageSourceInfo::pixelFormat](#pixelformat-33) | Defines the pixel format of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).|
187| [OhosImageSourceInfo::colorSpace](#colorspace) | Defines the color space of the image source.|
188| [OhosImageSourceInfo::alphaType](#alphatype) | Defines the alpha type of the image source.|
189| [OhosImageSourceInfo::density](#density-22) | Defines the image density of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).|
190| [OhosImageSourceInfo::size](#size-37) | Defines the pixel width and height of the image source.|
191| [OhosImageSource::uri](#uri) = nullptr | Defines a pointer to the image source URI. Only a file URI or Base64 URI is accepted.|
192| [OhosImageSource::uriSize](#urisize) = 0 | Defines the length of the image source URI.|
193| [OhosImageSource::fd](#fd) = -1 | Defines the descriptor of the image source.|
194| [OhosImageSource::buffer](#buffer-12) = nullptr | Defines a pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.|
195| [OhosImageSource::bufferSize](#buffersize-12) = 0 | Defines the size of the image source buffer.|
196| [OhosImageSourceDelayTimeList::delayTimeList](#delaytimelist) | Defines a pointer to the head of the image source delay time list.|
197| [OhosImageSourceDelayTimeList::size](#size-47) = 0 | Defines the size of the image source delay time list.|
198| [OhosImageSourceSupportedFormat::format](#format) = nullptr | Defines a pointer to the head of the format string.|
199| [OhosImageSourceSupportedFormat::size](#size-57) = 0 | Defines the size of the format string.|
200| [OhosImageSourceSupportedFormatList::supportedFormatList](#supportedformatlist) = nullptr | Defines a double pointer to the head of the format string list.|
201| [OhosImageSourceSupportedFormatList::size](#size-67) = 0 | Defines the size of the format string list.|
202| [OhosImageSourceProperty::value](#value) = nullptr | Defines a pointer to the head of the property string.|
203| [OhosImageSourceProperty::size](#size-77) = 0 | Defines the size of the property string.|
204| [OhosImageSourceUpdateData::buffer](#buffer-22) = nullptr | Defines a pointer to the buffer for storing the update data.|
205| [OhosImageSourceUpdateData::bufferSize](#buffersize-22) = 0 | Defines the size of the buffer.|
206| [OhosImageSourceUpdateData::offset](#offset) = 0 | Defines the offset of the update data in the buffer.|
207| [OhosImageSourceUpdateData::updateLength](#updatelength) = 0 | Defines the length of the update data in the buffer.|
208| [OhosImageSourceUpdateData::isCompleted](#iscompleted) = 0 | Defines whether the image source data update is completed.|
209
210
211## Type Description
212
213
214### ImageNative
215
216```
217typedef struct ImageNative_ ImageNative
218```
219
220**Description**
221
222Defines an image object at the native layer.
223
224**Since**: 10
225
226
227### ImagePacker_Native
228
229```
230typedef struct ImagePacker_Native_ ImagePacker_Native
231```
232
233**Description**
234
235Defines an image packer object at the native layer.
236
237**Since**: 11
238
239
240### ImagePacker_Opts
241
242```
243typedef struct ImagePacker_Opts_ImagePacker_Opts
244```
245
246**Description**
247
248Defines the alias of the image packing options.
249
250**Since**: 11
251
252
253### ImageReceiverNative
254
255```
256typedef struct ImageReceiverNative_ ImageReceiverNative
257```
258
259**Description**
260
261Defines the data type name of the image receiver at the native layer.
262
263**Since**: 10
264
265
266### ImageSourceNative
267
268```
269typedef struct ImageSourceNative_ ImageSourceNative
270```
271
272**Description**
273
274Defines an image source object at the native layer.
275
276**Since**: 10
277
278
279### IRNdkErrCode
280
281```
282typedef enum anonymous3IRNdkErrCode
283```
284
285**Description**
286
287Defines an enum that enumerates the return values that may be used by the interface.
288
289**Since**: 10
290
291
292### NativePixelMap
293
294```
295typedef struct NativePixelMap_ NativePixelMap
296```
297
298**Description**
299
300Defines the data type name of the pixel map at the native layer.
301
302**Since**: 10
303
304
305### OH_Image_Receiver_On_Callback
306
307```
308typedef void(* OH_Image_Receiver_On_Callback) ()
309```
310
311**Description**
312
313Defines the callbacks for the image interface at the native layer.
314
315**Since**: 10
316
317
318### OhosPixelMapInfos
319
320```
321typedef struct OhosPixelMapInfos
322```
323
324**Description**
325
326Defines the information about a pixel map.
327
328**Since**: 10
329
330
331## Enum Description
332
333### anonymous enum [1/3]
334
335```
336anonymous enum
337```
338
339**Description**
340
341Enumerates the image formats.
342
343**Since**: 10
344
345| Value| Description|
346| -------- | -------- |
347| OHOS_IMAGE_FORMAT_YCBCR_422_SP | YCbCr422 semi-planar format.|
348| OHOS_IMAGE_FORMAT_JPEG | JPEG encoding format.|
349
350
351### anonymous enum [2/3]
352
353```
354anonymous enum
355```
356
357**Description**
358
359Enumerates the pixel map alpha types.
360
361**Since**: 10
362
363| Value| Description|
364| -------- | -------- |
365| OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN | Unknown format.|
366| OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE | Opaque format.|
367| OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL | Premultiplied format.|
368| OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL | Unpremultiplied format.|
369
370
371### anonymous enum [3/3]
372
373```
374anonymous enum
375```
376
377**Description**
378
379Enumerates the error codes returned by the functions.
380
381**Since**: 8
382
383**Deprecated from**: 10
384
385| Value| Description|
386| -------- | -------- |
387| OHOS_IMAGE_RESULT_SUCCESS | Operation success.|
388| OHOS_IMAGE_RESULT_BAD_PARAMETER | Invalid parameter.|
389
390
391### anonymous enum [1/3]
392
393```
394anonymous enum
395```
396
397**Description**
398
399Enumerates the image components.
400
401**Since**: 10
402
403| Value| Description|
404| -------- | -------- |
405| OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y | Luminance component.|
406| OHOS_IMAGE_COMPONENT_FORMAT_YUV_U | Chrominance component - blue projection.|
407| OHOS_IMAGE_COMPONENT_FORMAT_YUV_V | Chrominance component - red projection.|
408| OHOS_IMAGE_COMPONENT_FORMAT_JPEG | JPEG format.|
409
410
411### anonymous enum [2/3]
412
413```
414anonymous enum
415```
416
417**Description**
418
419Enumerates the pixel map editing types.
420
421**Since**: 10
422
423| Value| Description|
424| -------- | -------- |
425| OHOS_PIXEL_MAP_READ_ONLY | Read-only.|
426| OHOS_PIXEL_MAP_EDITABLE | Editable.|
427
428
429### anonymous enum [3/3]
430
431```
432anonymous enum
433```
434
435**Description**
436
437Enumerates the pixel map formats.
438
439**Since**: 8
440
441**Deprecated from**: 10
442
443| Value| Description|
444| -------- | -------- |
445| OHOS_PIXEL_MAP_FORMAT_NONE | Unknown format.|
446| OHOS_PIXEL_MAP_FORMAT_RGBA_8888 | 32-bit RGBA, with 8 bits each for R (red), G (green), B (blue), and A (alpha). The data is stored from the most significant bit to the least significant bit.|
447| OHOS_PIXEL_MAP_FORMAT_RGB_565 | 16-bit RGB, with 5, 6, and 5 bits for R, G, and B, respectively. The storage sequence is from the most significant bit to the least significant bit.|
448
449
450### anonymous enum
451
452```
453anonymous enum
454```
455
456**Description**
457
458Enumerates the pixel map scale modes.
459
460**Since**: 10
461
462| Value| Description|
463| -------- | -------- |
464| OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE | Adapting to the target image size.|
465| OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP | Cropping the center portion of an image to the target size.|
466
467
468### IRNdkErrCode
469
470```
471enum IRNdkErrCode
472```
473
474**Description**
475
476Enumerates the return values that may be used by the interface.
477
478**Since**: 10
479
480| Value| Description|
481| -------- | -------- |
482| IMAGE_RESULT_SUCCESS | Operation success.|
483| IMAGE_RESULT_BAD_PARAMETER | Invalid parameter.|
484| IMAGE_RESULT_IMAGE_RESULT_BASE | Operation failed.|
485| IMAGE_RESULT_ERR_IPC | IPC error.|
486| IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST | Failed to share the memory.|
487| IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL | Abnormal data in the shared memory.|
488| IMAGE_RESULT_DECODE_ABNORMAL | Failed to decode the image.|
489| IMAGE_RESULT_DATA_ABNORMAL | Abnormal input data.|
490| IMAGE_RESULT_MALLOC_ABNORMAL | An error occurs during memory allocation.|
491| IMAGE_RESULT_DATA_UNSUPPORT | The image type is not supported.|
492| IMAGE_RESULT_INIT_ABNORMAL | Failed to initialize the image.|
493| IMAGE_RESULT_GET_DATA_ABNORMAL | An error occurs during image data retrieval.|
494| IMAGE_RESULT_TOO_LARGE | The image is too large.|
495| IMAGE_RESULT_TRANSFORM | An error occurs during image transformation.|
496| IMAGE_RESULT_COLOR_CONVERT | An error occurs during image color conversion.|
497| IMAGE_RESULT_CROP | An error occurs during image cropping.|
498| IMAGE_RESULT_SOURCE_DATA | The image source data is incorrect.|
499| IMAGE_RESULT_SOURCE_DATA_INCOMPLETE | The image source data is incomplete.|
500| IMAGE_RESULT_MISMATCHED_FORMAT | The image format does not match.|
501| IMAGE_RESULT_UNKNOWN_FORMAT | Unknown image format.|
502| IMAGE_RESULT_SOURCE_UNRESOLVED | The image source is not parsed.|
503| IMAGE_RESULT_INVALID_PARAMETER | Invalid image parameter.|
504| IMAGE_RESULT_DECODE_FAILED | Failed to decode the image.|
505| IMAGE_RESULT_PLUGIN_REGISTER_FAILED | Failed to register the plug-in.|
506| IMAGE_RESULT_PLUGIN_CREATE_FAILED | Failed to create the plug-in.|
507| IMAGE_RESULT_ENCODE_FAILED | Failed to encode the image.|
508| IMAGE_RESULT_ADD_PIXEL_MAP_FAILED | Failed to add the pixel map.|
509| IMAGE_RESULT_HW_DECODE_UNSUPPORT | Hardware decoding is not supported.|
510| IMAGE_RESULT_DECODE_HEAD_ABNORMAL | Failed to decode the image header.|
511| IMAGE_RESULT_DECODE_EXIF_UNSUPPORT | Exchangeable Image File (EXIF) is not supported for image decoding.|
512| IMAGE_RESULT_PROPERTY_NOT_EXIST | The image property does not exist.|
513| IMAGE_RESULT_MEDIA_DATA_UNSUPPORT | The media type is not supported.|
514| IMAGE_RESULT_MEDIA_TOO_LARGE | The media is too large.|
515| IMAGE_RESULT_MEDIA_MALLOC_FAILED | Memory allocation failed.|
516| IMAGE_RESULT_MEDIA_END_OF_STREAM | Failed to end the media data stream.|
517| IMAGE_RESULT_MEDIA_IO_ABNORMAL | Abnormal input and output streams.|
518| IMAGE_RESULT_MEDIA_MALFORMED | The media service functions abnormally.|
519| IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL | The media data is too small.|
520| IMAGE_RESULT_MEDIA_OUT_OF_RANGE | The media is out of range.|
521| IMAGE_RESULT_MEDIA_STATUS_ABNORMAL | Abnormal media status.|
522| IMAGE_RESULT_MEDIA_VALUE_INVALID | Invalid media value.|
523| IMAGE_RESULT_MEDIA_NULL_POINTER | Media operation failed.|
524| IMAGE_RESULT_MEDIA_INVALID_OPERATION | Invalid media operation.|
525| IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT | An error occurs during media initialization.|
526| IMAGE_RESULT_MEDIA_EARLY_PREPARE | Media preprocessing is carried out too early.|
527| IMAGE_RESULT_MEDIA_SEEK_ERR | The seek operation failed.|
528| IMAGE_RESULT_MEDIA_PERMISSION_DENIED | Permission denied.|
529| IMAGE_RESULT_MEDIA_DEAD_OBJECT | The media object is deregistered.|
530| IMAGE_RESULT_MEDIA_TIMED_OUT | A timeout occurs.|
531| IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED | The media capability is not supported.|
532| IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED | Failed to initialize the media adapter.|
533| IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL | Failed to write data to the parcel.|
534| IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL | Failed to read data from the parcel.|
535| IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER | Invalid data.|
536| IMAGE_RESULT_MEDIA_INVALID_PARAM | Invalid parameters.|
537| IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST | The media codec adapter does not exist.|
538| IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED | Failed to create the media codec adapter.|
539| IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT | The media codec adapter is not initialized.|
540| IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED | Failed to create the media codec.|
541| IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST | The media codec does not exist.|
542| IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST | The media JNI layer class does not exist.|
543| IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST | The media JNI layer method does not exist.|
544| IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED | Failed to create the object at the media JNI layer.|
545| IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR | The media JNI layer is abnormal.|
546| IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT | The distributed feature is not supported.|
547| IMAGE_RESULT_MEDIA_SOURCE_NOT_SET | The media source is not set.|
548| IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT | The media RTSP adapter is not initialized.|
549| IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST | The media RTSP adapter does not exist.|
550| IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT | The media does not support the RTSP surface.|
551| IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT | Failed to initialize the media RTSP capturer.|
552| IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID | Invalid media RTSP source path.|
553| IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND | No video capability is found in the media RTSP.|
554| IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX | The maximum number of RTSP cameras has been reached.|
555| IMAGE_RESULT_MEDIA_SET_VOLUME | Failed to set the volume.|
556| IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW | The number of operations overflows.|
557| IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED | The distributed media player is not supported.|
558| IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED | Failed to decode the ICC.|
559| IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED | Failed to encode the ICC.|
560| IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED | Failed to read the pixel map.|
561| IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED | Failed to write the pixel map.|
562| IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY | The pixel map cannot be modified.|
563| IMAGE_RESULT_MEDIA_CONFIG_FAILED | Configuration failed.|
564| IMAGE_RESULT_JNI_ENV_ABNORMAL | The JNI environment is abnormal.|
565| IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED | Failed to allocate memory for the surface.|
566| IMAGE_RESULT_CREATE_SURFACE_FAILED | Failed to create the surface.|
567| IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED | Failed to obtain parameters from the surface.|
568| IMAGE_RESULT_GET_SURFACE_FAILED | Failed to obtain the surface.|
569| IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED | Failed to apply for a buffer.|
570| IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED | Failed to request a buffer.|
571| IMAGE_RESULT_REGISTER_LISTENER_FAILED | Failed to register the listener.|
572| IMAGE_RESULT_REGISTER_BUFFER_FAILED | Failed to register the buffer.|
573| IMAGE_RESULT_FREAD_FAILED | Failed to read the file.|
574| IMAGE_RESULT_PEEK_FAILED | Failed to peek the file.|
575| IMAGE_RESULT_SEEK_FAILED | Failed to seek the file.|
576| IMAGE_RESULT_STREAM_SIZE_ERROR | The data stream is damaged.|
577| IMAGE_RESULT_FILE_FD_ERROR | The file descriptor is damaged.|
578| IMAGE_RESULT_FILE_DAMAGED | The file is damaged.|
579| IMAGE_RESULT_CREATE_DECODER_FAILED | Failed to create a decoder.|
580| IMAGE_RESULT_CREATE_ENCODER_FAILED | Failed to create an encoder.|
581| IMAGE_RESULT_CHECK_FORMAT_ERROR | Failed to check the format.|
582| IMAGE_RESULT_THIRDPART_SKIA_ERROR | Skia decoding failed.|
583| IMAGE_RESULT_HW_DECODE_FAILED | Hardware decoding failed.|
584| IMAGE_RESULT_ALLOCATER_TYPE_ERROR | Failed to verify the memory type.|
585| IMAGE_RESULT_ALPHA_TYPE_ERROR | Failed to verify the alpha type.|
586| IMAGE_RESULT_INDEX_INVALID | Invalid parameter.|
587| IMAGE_RESULT_MEDIA_UNKNOWN | Unknown error.|
588
589
590## Function Description
591
592
593### OH_AccessPixels()
594
595```
596int32_t OHOS::Media::OH_AccessPixels (napi_env env, napi_value value, void ** addrPtr )
597```
598
599**Description**
600
601Obtains the memory address of a **PixelMap** object and locks the memory.
602
603**\*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.
604
605**Since**: 8
606
607**Deprecated from**: 10
608
609**Parameters**
610
611| Name| Description|
612| -------- | -------- |
613| env | Pointer to the NAPI environment.|
614| value | **PixelMap** object at the application layer.|
615| addrPtr | Double pointer to the memory address.|
616
617**See**
618
619[UnAccessPixels](image.md#oh_unaccesspixels)
620
621**Returns**
622
623Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful; returns an error code otherwise.
624
625
626### OH_GetImageInfo()
627
628```
629int32_t OHOS::Media::OH_GetImageInfo (napi_env env, napi_value value, OhosPixelMapInfo * info )
630```
631
632**Description**
633
634Obtains the information about a **PixelMap** object and stores the information to the [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) struct.
635
636**Since**: 8
637
638**Deprecated from**: 10
639
640**Parameters**
641
642| Name| Description|
643| -------- | -------- |
644| env | Pointer to the NAPI environment.|
645| value | **PixelMap** object at the application layer.|
646| info | Pointer to the object that stores the information obtained. For details, see [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md).|
647
648**Returns**
649
650Returns **0** if the information is obtained and stored successfully; returns an error code otherwise.
651
652**See**
653
654[OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md)
655
656
657### OH_Image_ClipRect()
658
659```
660int32_t OH_Image_ClipRect (const ImageNative * native, struct OhosImageRect * rect )
661```
662
663**Description**
664
665Obtains [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) of an **ImageNative** object.
666
667**Since**: 10
668
669**Parameters**
670
671| Name| Description|
672| -------- | -------- |
673| native | Pointer to an **ImageNative** object.|
674| rect | Pointer to the [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) object obtained.|
675
676**Returns**
677
678For details, see [IRNdkErrCode](#irndkerrcode-1).
679
680Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
681
682Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
683
684Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
685
686Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
687
688Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
689
690**See**
691
692[ImageNative](image.md#imagenative), [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md)
693
694
695### OH_Image_Format()
696
697```
698int32_t OH_Image_Format (const ImageNative * native, int32_t * format )
699```
700
701**Description**
702
703Obtains the format of an **ImageNative** object.
704
705**Since**: 10
706
707**Parameters**
708
709| Name| Description|
710| -------- | -------- |
711| native | Pointer to an **ImageNative** object.|
712| format | Pointer to the image format obtained.|
713
714**Returns**
715
716For details, see [IRNdkErrCode](#irndkerrcode-1).
717
718Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
719
720Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
721
722Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
723
724Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
725
726Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
727
728
729**See**
730
731[ImageNative](image.md#imagenative)
732
733
734### OH_Image_GetComponent()
735
736```
737int32_t OH_Image_GetComponent (const ImageNative * native, int32_t componentType, struct OhosImageComponent * componentNative )
738```
739
740**Description**
741
742Obtains [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) of an **ImageNative** object.
743
744**Since**: 10
745
746**Parameters**
747
748| Name| Description|
749| -------- | -------- |
750| native | Pointer to an **ImageNative** object.|
751| componentType | Type of the component.|
752| componentNative | Pointer to the [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) object obtained.|
753
754**Returns**
755
756For details, see [IRNdkErrCode](#irndkerrcode-1).
757
758Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
759
760Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
761
762Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
763
764Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
765
766Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
767
768**See**
769
770[ImageNative](image.md#imagenative), [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md)
771
772
773### OH_Image_InitImageNative()
774
775```
776ImageNative* OH_Image_InitImageNative (napi_env env, napi_value source )
777```
778
779**Description**
780
781Parses an **ImageNative** object from an **Image** object at the JavaScript native layer.
782
783**Since**: 10
784
785**Parameters**
786
787| Name| Description|
788| -------- | -------- |
789| env | Pointer to the JNI environment.|
790| source | **Image** object at the JavaScript native layer.|
791
792**Returns**
793
794Returns a pointer to the **ImageNative** object if the operation is successful; returns a null pointer otherwise.
795
796**See**
797
798[ImageNative](image.md#imagenative), [OH_Image_Release](image.md#oh_image_release)
799
800
801### OH_Image_Receiver_CreateImageReceiver()
802
803```
804int32_t OH_Image_Receiver_CreateImageReceiver (napi_env env, struct OhosImageReceiverInfo info, napi_value * res )
805```
806
807**Description**
808
809Creates an **ImageReceiver** object at the application layer.
810
811**Since**: 10
812
813**Parameters**
814
815| Name| Description|
816| -------- | -------- |
817| env | Pointer to the NAPI environment.|
818| info | Options for setting the **ImageReceiver** object.|
819| res | Pointer to the **ImageReceiver** object at the application layer.|
820
821**Returns**
822
823For details, see [IRNdkErrCode](#irndkerrcode-1).
824
825Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
826
827Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
828
829Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
830
831Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
832
833Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
834
835Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
836
837Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
838
839Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
840
841Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
842
843Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
844
845Returns **IMAGE_RESULT_MEDIA_DATA_UNSUPPORT** if the media type is not supported.
846
847
848**See**
849
850[OhosImageReceiverInfo](_ohos_image_receiver_info.md)
851
852
853### OH_Image_Receiver_GetCapacity()
854
855```
856int32_t OH_Image_Receiver_GetCapacity (const ImageReceiverNative * native, int32_t * capacity )
857```
858
859**Description**
860
861Obtains the capacity of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
862
863**Since**: 10
864
865**Parameters**
866
867| Name| Description|
868| -------- | -------- |
869| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
870| capacity | Pointer to the capacity obtained.|
871
872**Returns**
873
874For details, see [IRNdkErrCode](#irndkerrcode-1).
875
876Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
877
878Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
879
880Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
881
882Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
883
884Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
885
886
887**See**
888
889[ImageReceiverNative](#imagereceivernative), [OhosImageSize](_ohos_image_size.md)
890
891
892### OH_Image_Receiver_GetFormat()
893
894```
895int32_t OH_Image_Receiver_GetFormat (const ImageReceiverNative * native, int32_t * format )
896```
897
898**Description**
899
900Obtains the format of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
901
902**Since**: 10
903
904**Parameters**
905
906| Name| Description|
907| -------- | -------- |
908| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
909| format | Pointer to the format obtained.|
910
911**Returns**
912
913For details, see [IRNdkErrCode](#irndkerrcode-1).
914
915Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
916
917Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
918
919Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
920
921Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
922
923Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
924
925
926**See**
927
928[ImageReceiverNative](#imagereceivernative)
929
930
931### OH_Image_Receiver_GetReceivingSurfaceId()
932
933```
934int32_t OH_Image_Receiver_GetReceivingSurfaceId (const ImageReceiverNative * native, char * id, size_t len )
935```
936
937**Description**
938
939Obtains the receiver ID through an [ImageReceiverNative](#imagereceivernative) object.
940
941**Since**: 10
942
943**Parameters**
944
945| Name| Description|
946| -------- | -------- |
947| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
948| id | Pointer to the buffer that stores the ID string obtained.|
949| len | Size of the buffer.|
950
951**Returns**
952
953For details, see [IRNdkErrCode](#irndkerrcode-1).
954
955Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
956
957Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
958
959Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
960
961Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
962
963Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
964
965Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
966
967Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
968
969Returns **IMAGE_RESULT_MEDIA_DATA_UNSUPPORT** if the media type is not supported.
970
971
972**See**
973
974[ImageReceiverNative](#imagereceivernative)
975
976
977### OH_Image_Receiver_GetSize()
978
979```
980int32_t OH_Image_Receiver_GetSize (const ImageReceiverNative * native, struct OhosImageSize * size )
981```
982
983**Description**
984
985Obtains the size of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
986
987**Since**: 10
988
989**Parameters**
990
991| Name| Description|
992| -------- | -------- |
993| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
994| size | Pointer to the [OhosImageSize](_ohos_image_size.md) object obtained.|
995
996**Returns**
997
998For details, see [IRNdkErrCode](#irndkerrcode-1).
999
1000Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1001
1002Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1003
1004Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1005
1006Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1007
1008Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1009
1010**See**
1011
1012[ImageReceiverNative](#imagereceivernative), [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback)
1013
1014
1015### OH_Image_Receiver_InitImageReceiverNative()
1016
1017```
1018ImageReceiverNative* OH_Image_Receiver_InitImageReceiverNative (napi_env env, napi_value source )
1019```
1020
1021**Description**
1022
1023Initializes an [ImageReceiverNative](#imagereceivernative) object through an **ImageReceiver** object.
1024
1025**Since**: 10
1026
1027**Parameters**
1028
1029| Name| Description|
1030| -------- | -------- |
1031| env | Pointer to the NAPI environment.|
1032| source | **ImageReceiver** object.|
1033
1034**Returns**
1035
1036Returns a pointer to the [ImageReceiverNative](#imagereceivernative) object obtained if the operation is successful; returns a null pointer otherwise.
1037
1038**See**
1039
1040[ImageReceiverNative](#imagereceivernative), [OH_Image_Receiver_Release](#oh_image_receiver_release)
1041
1042
1043### OH_Image_Receiver_On()
1044
1045```
1046int32_t OH_Image_Receiver_On (const ImageReceiverNative * native, OH_Image_Receiver_On_Callback callback )
1047```
1048
1049**Description**
1050
1051Registers an [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback. This callback is triggered whenever a new image is received.
1052
1053**Since**: 10
1054
1055**Parameters**
1056
1057| Name| Description|
1058| -------- | -------- |
1059| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
1060| callback | [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback to register.|
1061
1062**Returns**
1063
1064For details, see [IRNdkErrCode](#irndkerrcode-1).
1065
1066Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1067
1068Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1069
1070Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1071
1072Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid or a parameter fails to be obtained from the surface.
1073
1074Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1075
1076Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1077
1078Returns **IMAGE_RESULT_REGISTER_LISTENER_FAILED** if the listener fails to be registered.
1079
1080Returns **IMAGE_RESULT_REGISTER_BUFFER_FAILED** if the buffer fails to be registered.
1081
1082
1083**See**
1084
1085[ImageReceiverNative](#imagereceivernative)
1086
1087
1088### OH_Image_Receiver_ReadLatestImage()
1089
1090```
1091int32_t OH_Image_Receiver_ReadLatestImage (const ImageReceiverNative * native, napi_value * image )
1092```
1093
1094**Description**
1095
1096Obtains the latest image through an [ImageReceiverNative](#imagereceivernative) object.
1097
1098**Since**: 10
1099
1100**Parameters**
1101
1102| Name| Description|
1103| -------- | -------- |
1104| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
1105| image | Pointer to an **Image** object at the application layer.|
1106
1107**Returns**
1108
1109For details, see [IRNdkErrCode](#irndkerrcode-1).
1110
1111Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1112
1113Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1114
1115Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1116
1117Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1118
1119Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1120
1121Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
1122
1123Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
1124
1125Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1126
1127Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
1128
1129Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1130
1131Returns **IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED** if the buffer fails to be requested.
1132
1133
1134**See**
1135
1136[ImageReceiverNative](#imagereceivernative)
1137
1138
1139### OH_Image_Receiver_ReadNextImage()
1140
1141```
1142int32_t OH_Image_Receiver_ReadNextImage (const ImageReceiverNative * native, napi_value * image )
1143```
1144
1145**Description**
1146
1147Obtains the next image through an [ImageReceiverNative](#imagereceivernative) object.
1148
1149**Since**: 10
1150
1151**Parameters**
1152
1153| Name| Description|
1154| -------- | -------- |
1155| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
1156| image | Pointer to an **Image** object at the application layer.|
1157
1158**Returns**
1159
1160For details, see [IRNdkErrCode](#irndkerrcode-1).
1161
1162Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1163
1164Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1165
1166Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1167
1168Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1169
1170Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1171
1172Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
1173
1174Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
1175
1176Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1177
1178Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
1179
1180Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1181
1182Returns **IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED** if the buffer fails to be requested.
1183
1184**See**
1185
1186[ImageReceiverNative](#imagereceivernative)
1187
1188
1189### OH_Image_Receiver_Release()
1190
1191```
1192int32_t OH_Image_Receiver_Release (ImageReceiverNative * native)
1193```
1194
1195**Description**
1196
1197Releases an [ImageReceiverNative](#imagereceivernative) object. Note: This function is not used to release an **ImageReceiver** object.
1198
1199**Since**: 10
1200
1201**Parameters**
1202
1203| Name| Description|
1204| -------- | -------- |
1205| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object.|
1206
1207**Returns**
1208
1209For details, see [IRNdkErrCode](#irndkerrcode-1).
1210
1211Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1212
1213Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1214
1215Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1216
1217Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1218
1219
1220**See**
1221
1222[ImageReceiverNative](#imagereceivernative)
1223
1224
1225### OH_Image_Release()
1226
1227```
1228int32_t OH_Image_Release (ImageNative * native)
1229```
1230
1231**Description**
1232
1233Releases an **ImageNative** object. Note: This function is not used to release an **Image** object at the JavaScript native API. It is used to release an **ImageNative** object parsed by calling **OH_Image_InitImageNative**.
1234
1235**Since**: 10
1236
1237**Parameters**
1238
1239| Name| Description|
1240| -------- | -------- |
1241| native | Pointer to an **ImageNative** object.|
1242
1243**Returns**
1244
1245For details, see [IRNdkErrCode](#irndkerrcode-1).
1246
1247Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1248
1249Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1250
1251Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1252
1253Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1254
1255**See**
1256
1257[ImageNative](image.md#imagenative), [OH_Image_InitImageNative](image.md#oh_image_initimagenative)
1258
1259
1260### OH_Image_Size()
1261
1262```
1263int32_t OH_Image_Size (const ImageNative * native, struct OhosImageSize * size )
1264```
1265
1266**Description**
1267
1268Obtains [OhosImageSize](_ohos_image_size.md) of an **ImageNative** object.
1269
1270**Since**: 10
1271
1272**Parameters**
1273
1274| Name| Description|
1275| -------- | -------- |
1276| native | Pointer to an **ImageNative** object.|
1277| size | Pointer to the [OhosImageSize](_ohos_image_size.md) object obtained.|
1278
1279**Returns**
1280
1281For details, see [IRNdkErrCode](#irndkerrcode-1).
1282
1283Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1284
1285Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1286
1287Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1288
1289Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1290
1291Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1292
1293**See**
1294
1295[ImageNative](image.md#imagenative), [OhosImageSize](_ohos_image_size.md)
1296
1297
1298### OH_ImagePacker_Create()
1299
1300```
1301int32_t OH_ImagePacker_Create (napi_env env, napi_value * res )
1302```
1303
1304**Description**
1305
1306Obtains an **ImagePacker** object at the JavaScript native layer.
1307
1308**Since**: 11
1309
1310**Parameters**
1311
1312| Name| Description|
1313| -------- | -------- |
1314| env | Pointer to the JNI environment.|
1315| res | Pointer to an **ImagePacker** object at the JavaScript native layer.|
1316
1317**Returns**
1318
1319For details, see [IRNdkErrCode](#irndkerrcode-1).
1320
1321Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1322
1323Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1324
1325
1326### OH_ImagePacker_InitNative()
1327
1328```
1329ImagePacker_Native* OH_ImagePacker_InitNative (napi_env env, napi_value packer )
1330```
1331
1332**Description**
1333
1334Converts an **ImagePacker** object at the JavaScript native layer into an **ImagePacker_Native** object.
1335
1336**Since**: 11
1337
1338**Parameters**
1339
1340| Name| Description|
1341| -------- | -------- |
1342| env | Pointer to the JNI environment.|
1343| packer | **ImagePacker** object at the JavaScript native layer.|
1344
1345**Returns**
1346
1347Returns the pointer to an [ImagePacker_Native](#imagepacker_native) object if the operation is successful; returns a null pointer otherwise.
1348
1349**See**
1350
1351[OH_ImagePacker_Release](#oh_imagepacker_release)
1352
1353
1354### OH_ImagePacker_PackToData()
1355
1356```
1357int32_t OH_ImagePacker_PackToData (ImagePacker_Native * native, napi_value source, ImagePacker_Opts * opts, uint8_t * outData, size_t * size )
1358```
1359
1360**Description**
1361
1362Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a buffer (defined by **outData**) based on the specified **ImagePacker_Opts** struct.
1363
1364**Since**: 11
1365
1366**Parameters**
1367
1368| Name| Description|
1369| -------- | -------- |
1370| native | Pointer to an **ImagePacker_Native** object.|
1371| source | **PixelMap** object or **ImageSource** object at the JavaScript native layer.|
1372| opts | Pointer to the packing options. For details, see [ImagePacker_Opts](#imagepacker_opts).|
1373| outData | Pointer to the output buffer.|
1374| size | Pointer to the size of the buffer.|
1375
1376**Returns**
1377
1378For details, see [IRNdkErrCode](#irndkerrcode-1).
1379
1380Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1381
1382Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1383
1384Returns **ERR_IMAGE_DATA_ABNORMAL** if the output buffer is abnormal.
1385
1386Returns **ERR_IMAGE_MISMATCHED_FORMAT** if the format does not match.
1387
1388Returns **ERR_IMAGE_MALLOC_ABNORMAL** if an internal error occurs during buffer memory allocation.
1389
1390Returns **ERR_IMAGE_DECODE_ABNORMAL** if an internal error occurs during codec initialization.
1391
1392Returns **ERR_IMAGE_ENCODE_FAILED** if an error occurs during encoding.
1393
1394**See**
1395
1396[OH_ImagePacker_PackToFile](#oh_imagepacker_packtofile)
1397
1398
1399### OH_ImagePacker_PackToFile()
1400
1401```
1402int32_t OH_ImagePacker_PackToFile (ImagePacker_Native * native, napi_value source, ImagePacker_Opts * opts, int fd )
1403```
1404
1405**Description**
1406
1407Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a file based on the specified **ImagePacker_Opts** struct.
1408
1409**Since**: 11
1410
1411**Parameters**
1412
1413| Name| Description|
1414| -------- | -------- |
1415| native | Pointer to an **ImagePacker_Native** object.|
1416| source | **PixelMap** object or **ImageSource** object at the JavaScript native layer.|
1417| opts | Pointer to the packing options. For details, see [ImagePacker_Opts](#imagepacker_opts).|
1418| fd | File descriptor of the output file.|
1419
1420**Returns**
1421
1422For details, see [IRNdkErrCode](#irndkerrcode-1).
1423
1424Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1425
1426Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1427
1428Returns **ERR_IMAGE_DATA_ABNORMAL** if the output buffer is abnormal.
1429
1430Returns **ERR_IMAGE_MISMATCHED_FORMAT** if the format does not match.
1431
1432Returns **ERR_IMAGE_MALLOC_ABNORMAL** if an internal error occurs during buffer memory allocation.
1433
1434Returns **ERR_IMAGE_DECODE_ABNORMAL** if an internal error occurs during codec initialization.
1435
1436Returns **ERR_IMAGE_ENCODE_FAILED** if an error occurs during encoding.
1437
1438**See**
1439
1440[OH_ImagePacker_PackToData](#oh_imagepacker_packtodata)
1441
1442
1443### OH_ImagePacker_Release()
1444
1445```
1446int32_t OH_ImagePacker_Release (ImagePacker_Native * native)
1447```
1448
1449**Description**
1450
1451Releases an [ImagePacker_Native](#imagepacker_native) object,
1452
1453rather than the **ImagePacker** object at the JavaScript native layer.
1454
1455It is parsed by calling [OH_ImagePacker_InitNative](#oh_imagepacker_initnative).
1456
1457**Since**: 11
1458
1459**Parameters**
1460
1461| Name| Description|
1462| -------- | -------- |
1463| native | Pointer to an [ImagePacker_Native](#imagepacker_native) object.|
1464
1465**Returns**
1466
1467For details, see [IRNdkErrCode](#irndkerrcode-1).
1468
1469Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1470
1471**See**
1472
1473[OH_ImagePacker_InitNative](#oh_imagepacker_initnative)
1474
1475
1476
1477### OH_ImageSource_Create()
1478
1479```
1480int32_t OH_ImageSource_Create (napi_env env, struct OhosImageSource * src, struct OhosImageSourceOps * ops, napi_value * res )
1481```
1482
1483**Description**
1484
1485Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs.
1486
1487**Since**: 10
1488
1489**Deprecated from**: 11
1490
1491Use [OH_ImageSource_CreateFromUri](#oh_imagesource_createfromuri), [OH_ImageSource_CreateFromFd](#oh_imagesource_createfromfd) or [OH_ImageSource_CreateFromData](#oh_imagesource_createfromdata) instead.
1492
1493**Parameters**
1494
1495| Name| Description|
1496| -------- | -------- |
1497| env | Pointer to the JNI environment.|
1498| src | Pointer to the input resource of the image source. For details, see [OhosImageSource](_ohos_image_source.md).|
1499| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1500| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1501
1502**Returns**
1503
1504For details, see [IRNdkErrCode](#irndkerrcode-1).
1505
1506Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1507
1508Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1509
1510Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1511
1512Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1513
1514Returns **IMAGE_RESULT_SOURCE_DATA_INCOMPLETE** if the image source data is incomplete.
1515
1516Returns **IMAGE_RESULT_SOURCE_DATA** if the image source data is incorrect.
1517
1518Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1519
1520Returns **IMAGE_RESULT_TOO_LARGE** if the image is too large.
1521
1522Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1523
1524Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1525
1526Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1527
1528Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
1529
1530Returns **IMAGE_RESULT_FILE_DAMAGED** if the file is damaged.
1531
1532Returns **IMAGE_RESULT_FILE_FD_ERROR** if the file descriptor is incorrect.
1533
1534Returns **IMAGE_RESULT_STREAM_SIZE_ERROR** if the data stream is incorrect.
1535
1536Returns **IMAGE_RESULT_SEEK_FAILED** if seeking the file fails.
1537
1538Returns **IMAGE_RESULT_PEEK_FAILED** if peeking the file fails.
1539
1540Returns **IMAGE_RESULT_FREAD_FAILED** if reading the file fails.
1541
1542**See**
1543
1544[OhosImageSource](_ohos_image_source.md), [OhosImageSourceOps](_ohos_image_source_ops.md)
1545
1546
1547
1548### OH_ImageSource_CreateFromData()
1549
1550```
1551int32_t OH_ImageSource_CreateFromData (napi_env env, uint8_t * data, size_t dataSize, struct OhosImageSourceOps * ops, napi_value * res )
1552```
1553
1554**Description**
1555
1556Creates an **ImageSource** object at the JavaScript native layer based on the specified image source buffer resource (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1557
1558**Since**: 11
1559
1560**Parameters**
1561
1562| Name| Description|
1563| -------- | -------- |
1564| env | Pointer to the JNI environment.|
1565| data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.|
1566| dataSize | Size of the image source buffer.|
1567| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1568| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1569
1570**Returns**
1571
1572For details, see [IRNdkErrCode](#irndkerrcode-1).
1573
1574Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1575
1576Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1577
1578Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1579
1580Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1581
1582**See**
1583
1584[OhosImageSourceOps](_ohos_image_source_ops.md)
1585
1586
1587### OH_ImageSource_CreateFromFd()
1588
1589```
1590int32_t OH_ImageSource_CreateFromFd (napi_env env, int32_t fd, struct OhosImageSourceOps * ops, napi_value * res )
1591```
1592
1593**Description**
1594
1595Creates an **ImageSource** object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1596
1597**Since**: 11
1598
1599**Parameters**
1600
1601| Name| Description|
1602| -------- | -------- |
1603| env | Pointer to the JNI environment.|
1604| fd | Descriptor of the image source.|
1605| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1606| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1607
1608**Returns**
1609
1610For details, see [IRNdkErrCode](#irndkerrcode-1).
1611
1612Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1613
1614Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1615
1616Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1617
1618Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1619
1620**See**
1621
1622[OhosImageSourceOps](_ohos_image_source_ops.md)
1623
1624
1625### OH_ImageSource_CreateFromRawFile()
1626
1627```
1628int32_t OH_ImageSource_CreateFromRawFile (napi_env env, RawFileDescriptor rawFile, struct OhosImageSourceOps * ops, napi_value * res )
1629```
1630
1631**Description**
1632
1633Creates an **ImageSource** object at the JavaScript native layer based on the specified raw file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1634
1635**Since**: 11
1636
1637**Parameters**
1638
1639| Name| Description|
1640| -------- | -------- |
1641| env | Pointer to the JNI environment.|
1642| rawFile | Descriptor of the image source resource.|
1643| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1644| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1645
1646**Returns**
1647
1648For details, see [IRNdkErrCode](#irndkerrcode-1).
1649
1650Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1651
1652Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1653
1654Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1655
1656Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1657
1658**See**
1659
1660[OhosImageSourceOps](_ohos_image_source_ops.md)
1661
1662
1663### OH_ImageSource_CreateFromUri()
1664
1665```
1666int32_t OH_ImageSource_CreateFromUri (napi_env env, char * uri, size_t size, struct OhosImageSourceOps * ops, napi_value * res )
1667```
1668
1669**Description**
1670
1671Creates an **ImageSource** object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1672
1673**Since**: 11
1674
1675**Parameters**
1676
1677| Name| Description|
1678| -------- | -------- |
1679| env | Pointer to the JNI environment.|
1680| uri | Pointer to the image source URI. Only a file URI or Base64 URI is accepted.|
1681| size | Length of the image source URI.|
1682| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1683| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1684
1685**Returns**
1686
1687For details, see [IRNdkErrCode](#irndkerrcode-1).
1688
1689Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1690
1691Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1692
1693Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1694
1695Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1696
1697**See**
1698
1699[OhosImageSourceOps](_ohos_image_source_ops.md)
1700
1701
1702### OH_ImageSource_CreateIncremental()
1703
1704```
1705int32_t OH_ImageSource_CreateIncremental (napi_env env, struct OhosImageSource * source, struct OhosImageSourceOps * ops, napi_value * res )
1706```
1707
1708**Description**
1709
1710Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs. The image source data will be updated through **OH_ImageSource_UpdateData**.
1711
1712**Since**: 10
1713
1714
1715**Deprecated from**: 11
1716
1717Use [OH_ImageSource_CreateIncrementalFromData](#oh_imagesource_createincrementalfromdata) instead.
1718
1719**Parameters**
1720
1721| Name| Description|
1722| -------- | -------- |
1723| env | Pointer to the JNI environment.|
1724| src | Pointer to the input resource of the image source. Only the buffer type is accepted. For details, see [OhosImageSource](_ohos_image_source.md).|
1725| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1726| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1727
1728**Returns**
1729
1730For details, see [IRNdkErrCode](#irndkerrcode-1).
1731
1732Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1733
1734Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1735
1736Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1737
1738Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1739
1740Returns **IMAGE_RESULT_SOURCE_DATA_INCOMPLETE** if the image source data is incomplete.
1741
1742Returns **IMAGE_RESULT_SOURCE_DATA** if the image source data is incorrect.
1743
1744Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1745
1746Returns **IMAGE_RESULT_TOO_LARGE** if the image is too large.
1747
1748Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1749
1750Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1751
1752Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1753
1754Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
1755
1756Returns **IMAGE_RESULT_FILE_DAMAGED** if the file is damaged.
1757
1758Returns **IMAGE_RESULT_FILE_FD_ERROR** if the file descriptor is incorrect.
1759
1760Returns **IMAGE_RESULT_STREAM_SIZE_ERROR** if the data stream is incorrect.
1761
1762Returns **IMAGE_RESULT_SEEK_FAILED** if seeking the file fails.
1763
1764Returns **IMAGE_RESULT_PEEK_FAILED** if peeking the file fails.
1765
1766Returns **IMAGE_RESULT_FREAD_FAILED** if reading the file fails.
1767
1768**See**
1769
1770[OhosImageSource](_ohos_image_source.md), [OhosImageSourceOps](_ohos_image_source_ops.md), [OH_ImageSource_UpdateData](#oh_imagesource_updatedata)
1771
1772
1773### OH_ImageSource_CreateIncrementalFromData()
1774
1775```
1776int32_t OH_ImageSource_CreateIncrementalFromData (napi_env env, uint8_t * data, size_t dataSize, struct OhosImageSourceOps * ops, napi_value * res )
1777```
1778
1779**Description**
1780
1781Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified image source buffer resource (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. The image data is updated through **OH_ImageSource_UpdateData**.
1782
1783**Since**: 11
1784
1785**Parameters**
1786
1787| Name| Description|
1788| -------- | -------- |
1789| env | Pointer to the JNI environment.|
1790| data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.|
1791| dataSize | Size of the image source buffer.|
1792| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md).|
1793| res | Pointer to an **ImageSource** object at the JavaScript native layer.|
1794
1795**Returns**
1796
1797For details, see [IRNdkErrCode](#irndkerrcode-1).
1798
1799Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1800
1801Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1802
1803Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1804
1805Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1806
1807**See**
1808
1809[OhosImageSourceOps](_ohos_image_source_ops.md)
1810
1811
1812### OH_ImageSource_CreatePixelMap()
1813
1814```
1815int32_t OH_ImageSource_CreatePixelMap (const ImageSourceNative * native, struct OhosImageDecodingOps * ops, napi_value * res )
1816```
1817
1818**Description**
1819
1820Decodes an **ImageSourceNative** object to obtain a **PixelMap** object at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.
1821
1822**Since**: 10
1823
1824**Parameters**
1825
1826| Name| Description|
1827| -------- | -------- |
1828| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
1829| ops | Pointer to the options for decoding the image source. For details, see [OhosImageDecodingOps](_ohos_image_decoding_ops.md).|
1830| res | Pointer to a **PixelMap** object at the JavaScript native layer.|
1831
1832**Returns**
1833
1834For details, see [IRNdkErrCode](#irndkerrcode-1).
1835
1836Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1837
1838Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1839
1840Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1841
1842Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1843
1844Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1845
1846Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1847
1848Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1849
1850Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
1851
1852Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
1853
1854Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
1855
1856Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
1857
1858Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
1859
1860Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
1861
1862Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
1863
1864Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
1865
1866Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
1867
1868Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1869
1870Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
1871
1872Returns **IMAGE_RESULT_CROP** if cropping fails.
1873
1874Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
1875
1876Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
1877
1878Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
1879
1880Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
1881
1882Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
1883
1884Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
1885
1886Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
1887
1888Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
1889
1890Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
1891
1892Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
1893
1894**See**
1895
1896[ImageSourceNative](#imagesourcenative), [OhosImageDecodingOps](_ohos_image_decoding_ops.md)
1897
1898
1899### OH_ImageSource_CreatePixelMapList()
1900
1901```
1902int32_t OH_ImageSource_CreatePixelMapList (const ImageSourceNative * native, struct OhosImageDecodingOps * ops, napi_value * res )
1903```
1904
1905**Description**
1906
1907Decodes an **ImageSourceNative** object to obtain all **PixelMap** objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.
1908
1909**Since**: 10
1910
1911**Parameters**
1912
1913| Name| Description|
1914| -------- | -------- |
1915| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
1916| ops | Pointer to the options for decoding the image source. For details, see [OhosImageDecodingOps](_ohos_image_decoding_ops.md).|
1917| res | Pointer to **PixelMap** objects at the JavaScript native layer.|
1918
1919**Returns**
1920
1921For details, see [IRNdkErrCode](#irndkerrcode-1).
1922
1923Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1924
1925Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1926
1927Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1928
1929Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1930
1931Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1932
1933Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1934
1935Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1936
1937Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
1938
1939Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
1940
1941Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
1942
1943Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
1944
1945Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
1946
1947Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
1948
1949Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
1950
1951Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
1952
1953Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
1954
1955Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1956
1957Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
1958
1959Returns **IMAGE_RESULT_CROP** if cropping fails.
1960
1961Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
1962
1963Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
1964
1965Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
1966
1967Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
1968
1969Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
1970
1971Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
1972
1973Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
1974
1975Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
1976
1977Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
1978
1979Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
1980
1981Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1982
1983Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
1984
1985**See**
1986
1987[ImageSourceNative](#imagesourcenative), [OhosImageDecodingOps](_ohos_image_decoding_ops.md)
1988
1989
1990### OH_ImageSource_GetDelayTime()
1991
1992```
1993int32_t OH_ImageSource_GetDelayTime (const ImageSourceNative * native, struct OhosImageSourceDelayTimeList * res )
1994```
1995
1996**Description**
1997
1998Obtains the delay time list from an **ImageSourceNative** object (such as GIF image source).
1999
2000**Since**: 10
2001
2002**Parameters**
2003
2004| Name| Description|
2005| -------- | -------- |
2006| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2007| res | Pointer to the [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) object obtained. When the input **delayTimeList** is a null pointer and **size** is **0**, the size of the delay time list is returned through **size** in **res**. To obtain the complete delay time list, a space greater than **size** is required.|
2008
2009**Returns**
2010
2011For details, see [IRNdkErrCode](#irndkerrcode-1).
2012
2013Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2014
2015Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2016
2017Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2018
2019Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2020
2021Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2022
2023Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2024
2025Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2026
2027Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2028
2029Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2030
2031Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2032
2033Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2034
2035Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2036
2037Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2038
2039Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2040
2041Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2042
2043Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2044
2045Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2046
2047Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2048
2049**See**
2050
2051[ImageSourceNative](#imagesourcenative), [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md)
2052
2053
2054### OH_ImageSource_GetFrameCount()
2055
2056```
2057int32_t OH_ImageSource_GetFrameCount (const ImageSourceNative * native, uint32_t * res )
2058```
2059
2060**Description**
2061
2062Obtains the number of frames from an **ImageSourceNative** object.
2063
2064**Since**: 10
2065
2066**Parameters**
2067
2068| Name| Description|
2069| -------- | -------- |
2070| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2071| res | Pointer to the frame count.|
2072
2073**Returns**
2074
2075For details, see [IRNdkErrCode](#irndkerrcode-1).
2076
2077Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2078
2079Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2080
2081Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2082
2083Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2084
2085Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2086
2087Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2088
2089Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2090
2091Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2092
2093Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2094
2095Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2096
2097Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2098
2099Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2100
2101Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2102
2103Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2104
2105Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2106
2107Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2108
2109Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2110
2111Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2112
2113**See**
2114
2115[ImageSourceNative](#imagesourcenative)
2116
2117
2118### OH_ImageSource_GetImageInfo()
2119
2120```
2121int32_t OH_ImageSource_GetImageInfo (const ImageSourceNative * native, int32_t index, struct OhosImageSourceInfo * info )
2122```
2123
2124**Description**
2125
2126Obtains image source information from an **ImageSourceNative** object by index.
2127
2128**Since**: 10
2129
2130**Parameters**
2131
2132| Name| Description|
2133| -------- | -------- |
2134| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2135| index | Index.|
2136| info | Pointer to the [OhosImageSourceInfo](_ohos_image_source_info.md) object obtained.|
2137
2138**Returns**
2139
2140For details, see [IRNdkErrCode](#irndkerrcode-1).
2141
2142Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2143
2144Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2145
2146Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2147
2148Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2149
2150Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2151
2152Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2153
2154Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2155
2156Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2157
2158Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2159
2160Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2161
2162Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2163
2164Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2165
2166Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2167
2168Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2169
2170Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2171
2172Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2173
2174Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2175
2176Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2177
2178
2179**See**
2180
2181[ImageSourceNative](#imagesourcenative), [OhosImageSourceInfo](_ohos_image_source_info.md)
2182
2183
2184### OH_ImageSource_GetImageProperty()
2185
2186```
2187int32_t OH_ImageSource_GetImageProperty (const ImageSourceNative * native, struct OhosImageSourceProperty * key, struct OhosImageSourceProperty * value )
2188```
2189
2190**Description**
2191
2192Obtains the value of an image property from an **ImageSourceNative** object.
2193
2194**Since**: 10
2195
2196**Parameters**
2197
2198| Name| Description|
2199| -------- | -------- |
2200| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2201| key | Pointer to the property. For details, see [OhosImageSourceProperty](_ohos_image_source_property.md).|
2202| value | Pointer to the [OhosImageSourceProperty](_ohos_image_source_property.md) object obtained. If the input **value** is a null pointer and **size** is **0**, the size of the property value is returned through **size** in **value**. To obtain the complete property value, a space greater than **size** is required.|
2203
2204**Returns**
2205
2206For details, see [IRNdkErrCode](#irndkerrcode-1).
2207
2208Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2209
2210Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2211
2212Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2213
2214Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2215
2216Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2217
2218Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2219
2220Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2221
2222Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2223
2224Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2225
2226Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2227
2228Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2229
2230Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2231
2232Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2233
2234Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2235
2236Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2237
2238Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2239
2240Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2241
2242Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2243
2244**See**
2245
2246[ImageSourceNative](#imagesourcenative), [OhosImageSourceProperty](_ohos_image_source_property.md)
2247
2248
2249### OH_ImageSource_GetSupportedFormats()
2250
2251```
2252int32_t OH_ImageSource_GetSupportedFormats (struct OhosImageSourceSupportedFormatList * res)
2253```
2254
2255**Description**
2256
2257Obtains all supported decoding formats.
2258
2259**Since**: 10
2260
2261**Parameters**
2262
2263| Name| Description|
2264| -------- | -------- |
2265| res | Pointer to the [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) struct. If the input **supportedFormatList** is a null pointer and **size** is 0, the size of the supported formats is returned through **size** in **res**.<br>To obtain all formats, a space larger than **size** is required. In addition, sufficient space must be reserved for each format supported.|
2266
2267**Returns**
2268
2269For details, see [IRNdkErrCode](#irndkerrcode-1).
2270
2271Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2272
2273Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2274
2275Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2276
2277Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2278
2279Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2280
2281Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2282
2283**See**
2284
2285[OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md), [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md)
2286
2287
2288### OH_ImageSource_InitNative()
2289
2290```
2291ImageSourceNative* OH_ImageSource_InitNative (napi_env env, napi_value source )
2292```
2293
2294**Description**
2295
2296Converts an **ImageSource** object at the JavaScript native layer into an [ImageSourceNative](#imagesourcenative) object.
2297
2298**Since**: 10
2299
2300**Parameters**
2301
2302| Name| Description|
2303| -------- | -------- |
2304| env | Pointer to the JNI environment.|
2305| source | Pointer to an **ImageSource** object at the JavaScript native layer.|
2306
2307**Returns**
2308
2309Returns a pointer to the [ImageSourceNative](#imagesourcenative) object if the operation is successful; returns a null pointer otherwise.
2310
2311**See**
2312
2313[ImageSourceNative](#imagesourcenative), [OH_ImageSource_Release](#oh_imagesource_release)
2314
2315
2316### OH_ImageSource_ModifyImageProperty()
2317
2318```
2319int32_t OH_ImageSource_ModifyImageProperty (const ImageSourceNative * native, struct OhosImageSourceProperty * key, struct OhosImageSourceProperty * value )
2320```
2321
2322**Description**
2323
2324Modifies the value of an image property of an **ImageSourceNative** object.
2325
2326**Since**: 10
2327
2328**Parameters**
2329
2330| Name| Description|
2331| -------- | -------- |
2332| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2333| key | Pointer to the property. For details, see [OhosImageSourceProperty](_ohos_image_source_property.md).|
2334| value | Pointer to the new value of the property.|
2335
2336**Returns**
2337
2338For details, see [IRNdkErrCode](#irndkerrcode-1).
2339
2340Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2341
2342Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2343
2344Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2345
2346Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2347
2348Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2349
2350Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2351
2352Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2353
2354Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2355
2356Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2357
2358Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2359
2360Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2361
2362Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2363
2364Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2365
2366Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2367
2368Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2369
2370Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2371
2372Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2373
2374Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2375
2376**See**
2377
2378[ImageSourceNative](#imagesourcenative), [OhosImageSourceProperty](_ohos_image_source_property.md)
2379
2380
2381### OH_ImageSource_Release()
2382
2383```
2384int32_t OH_ImageSource_Release (ImageSourceNative * native)
2385```
2386
2387**Description**
2388
2389Releases an **ImageSourceNative** object.
2390
2391**Since**: 10
2392
2393**Parameters**
2394
2395| Name| Description|
2396| -------- | -------- |
2397| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2398
2399**Returns**
2400
2401For details, see [IRNdkErrCode](#irndkerrcode-1).
2402
2403Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2404
2405Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2406
2407Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2408
2409Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2410
2411Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2412
2413Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2414
2415**See**
2416
2417[ImageSourceNative](#imagesourcenative), [OH_ImageSource_Create](#oh_imagesource_create), [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental)
2418
2419
2420### OH_ImageSource_UpdateData()
2421
2422```
2423int32_t OH_ImageSource_UpdateData (const ImageSourceNative * native, struct OhosImageSourceUpdateData * data )
2424```
2425
2426**Description**
2427
2428Updates the data of an **ImageSourceNative** object.
2429
2430**Since**: 10
2431
2432**Parameters**
2433
2434| Name| Description|
2435| -------- | -------- |
2436| native | Pointer to an [ImageSourceNative](#imagesourcenative) object.|
2437| data | Pointer to the update data. For details, see [OhosImageSourceUpdateData](_ohos_image_source_update_data.md).|
2438
2439**Returns**
2440
2441
2442Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2443
2444Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2445
2446Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2447
2448Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2449
2450Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2451
2452Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2453
2454Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2455
2456Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2457
2458Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2459
2460Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2461
2462Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2463
2464Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2465
2466Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2467
2468Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2469
2470Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2471
2472Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2473
2474Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2475
2476Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2477
2478Returns **IMAGE_RESULT_CROP** if cropping fails.
2479
2480Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2481
2482Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2483
2484Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2485
2486Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2487
2488Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2489
2490Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2491
2492Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2493
2494Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2495
2496Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2497
2498Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2499
2500
2501**See**
2502
2503[ImageSourceNative](#imagesourcenative), [OhosImageSourceUpdateData](_ohos_image_source_update_data.md)
2504
2505
2506### OH_PixelMap_AccessPixels()
2507
2508```
2509int32_t OH_PixelMap_AccessPixels (const NativePixelMap * native, void ** addr )
2510```
2511
2512**Description**
2513
2514Obtains the memory address of a **NativePixelMap** object and locks the memory.
2515
2516**Since**: 10
2517
2518**Parameters**
2519
2520| Name| Description|
2521| -------- | -------- |
2522| native | Pointer to a **NativePixelMap** object.|
2523| addr | Double pointer to the memory address.|
2524
2525**Returns**
2526
2527For details, see [IRNdkErrCode](#irndkerrcode-1).
2528
2529Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2530
2531Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2532
2533Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2534
2535Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2536
2537Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2538
2539Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2540
2541Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2542
2543Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2544
2545Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2546
2547Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2548
2549Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2550
2551Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2552
2553Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2554
2555Returns **IMAGE_RESULT_CROP** if cropping fails.
2556
2557Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2558
2559Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2560
2561Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2562
2563Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2564
2565Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2566
2567Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2568
2569**See**
2570
2571[AccessPixels](image.md#oh_pixelmap_accesspixels)
2572
2573
2574### OH_PixelMap_CreateAlphaPixelMap()
2575
2576```
2577int32_t OH_PixelMap_CreateAlphaPixelMap (napi_env env, napi_value source, napi_value * alpha )
2578```
2579
2580**Description**
2581
2582Creates a **PixelMap** object that contains only alpha channel information.
2583
2584**Since**: 10
2585
2586**Parameters**
2587
2588| Name| Description|
2589| -------- | -------- |
2590| env | Pointer to the NAPI environment.|
2591| source | Options for setting the **PixelMap** object.|
2592| alpha | Pointer to the alpha channel.|
2593
2594**Returns**
2595
2596For details, see [IRNdkErrCode](#irndkerrcode-1).
2597
2598Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2599
2600Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2601
2602Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2603
2604Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2605
2606Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2607
2608Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2609
2610Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2611
2612Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2613
2614Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2615
2616Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2617
2618Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2619
2620Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2621
2622Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2623
2624Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2625
2626Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2627
2628Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2629
2630Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2631
2632Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2633
2634Returns **IMAGE_RESULT_CROP** if cropping fails.
2635
2636Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2637
2638Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2639
2640Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2641
2642Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2643
2644Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2645
2646Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2647
2648Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2649
2650Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2651
2652Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2653
2654Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2655
2656
2657**See**
2658
2659[CreateAlphaPixelMap](image.md#oh_pixelmap_createalphapixelmap)
2660
2661
2662### OH_PixelMap_CreatePixelMap()
2663
2664```
2665int32_t OH_PixelMap_CreatePixelMap (napi_env env, OhosPixelMapCreateOps info, void * buf, size_t len, napi_value * res )
2666```
2667
2668**Description**
2669
2670Creates a **PixelMap** object.
2671
2672**Since**: 10
2673
2674**Parameters**
2675
2676| Name| Description|
2677| -------- | -------- |
2678| env | Pointer to the NAPI environment.|
2679| info |Options for setting the **PixelMap** object.|
2680| buf | Pointer to the buffer of the image.|
2681| len | Image size.|
2682| res | Pointer to the **PixelMap** object at the application layer.|
2683
2684**Returns**
2685
2686For details, see [IRNdkErrCode](#irndkerrcode-1).
2687
2688Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2689
2690Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2691
2692Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2693
2694Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2695
2696Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2697
2698Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2699
2700Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2701
2702Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2703
2704Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2705
2706Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2707
2708Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2709
2710Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2711
2712Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2713
2714Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2715
2716Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2717
2718Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2719
2720Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2721
2722Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2723
2724Returns **IMAGE_RESULT_CROP** if cropping fails.
2725
2726Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2727
2728Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2729
2730Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2731
2732Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2733
2734Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2735
2736Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2737
2738Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2739
2740Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2741
2742Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2743
2744Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2745
2746**See**
2747
2748[CreatePixelMap](image.md#oh_pixelmap_createpixelmap)
2749
2750
2751### OH_PixelMap_Crop()
2752
2753```
2754int32_t OH_PixelMap_Crop (const NativePixelMap * native, int32_t x, int32_t y, int32_t width, int32_t height )
2755```
2756
2757**Description**
2758
2759Crops a **NativePixelMap** object.
2760
2761**Since**: 10
2762
2763**Parameters**
2764
2765| Name| Description|
2766| -------- | -------- |
2767| native | Pointer to a **NativePixelMap** object.|
2768| x | X-coordinate of the upper left corner of the target image.|
2769| y | Y-coordinate of the upper left corner of the target image.|
2770| width | Width of the cropped region.|
2771| height | Height of the cropped region.|
2772
2773**Returns**
2774
2775For details, see [IRNdkErrCode](#irndkerrcode-1).
2776
2777Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2778
2779Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2780
2781Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2782
2783Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2784
2785Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2786
2787Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2788
2789Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2790
2791Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2792
2793Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2794
2795Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2796
2797Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2798
2799Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2800
2801Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2802
2803Returns **IMAGE_RESULT_CROP** if cropping fails.
2804
2805Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2806
2807Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2808
2809Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2810
2811Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2812
2813Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2814
2815Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2816
2817**See**
2818
2819[Crop](image.md#oh_pixelmap_crop)
2820
2821
2822### OH_PixelMap_Flip()
2823
2824```
2825int32_t OH_PixelMap_Flip (const NativePixelMap * native, int32_t x, int32_t y )
2826```
2827
2828**Description**
2829
2830Flips a **NativePixelMap** object.
2831
2832**Since**: 10
2833
2834**Parameters**
2835
2836| Name| Description|
2837| -------- | -------- |
2838| native | Pointer to a **NativePixelMap** object.|
2839| x | Whether to flip around the x axis.|
2840| y | Whether to flip around the y axis.|
2841
2842**Returns**
2843
2844For details, see [IRNdkErrCode](#irndkerrcode-1).
2845
2846Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2847
2848Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2849
2850Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2851
2852Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2853
2854Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2855
2856Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2857
2858Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2859
2860Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2861
2862Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2863
2864Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2865
2866Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2867
2868Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2869
2870Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2871
2872Returns **IMAGE_RESULT_CROP** if cropping fails.
2873
2874Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2875
2876Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2877
2878Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2879
2880Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2881
2882Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2883
2884Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2885
2886
2887**See**
2888
2889[Flip](image.md#oh_pixelmap_flip)
2890
2891
2892### OH_PixelMap_GetBytesNumberPerRow()
2893
2894```
2895int32_t OH_PixelMap_GetBytesNumberPerRow (const NativePixelMap * native, int32_t * num )
2896```
2897
2898**Description**
2899
2900Obtains the number of bytes per row of a **NativePixelMap** object.
2901
2902**Since**: 10
2903
2904**Parameters**
2905
2906| Name| Description|
2907| -------- | -------- |
2908| native | Pointer to a **NativePixelMap** object.|
2909| num | Pointer to the number of bytes per row.|
2910
2911**Returns**
2912
2913For details, see [IRNdkErrCode](#irndkerrcode-1).
2914
2915Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2916
2917Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2918
2919Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2920
2921Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2922
2923Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2924
2925Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2926
2927**See**
2928
2929[GetBytesNumberPerRow](image.md#oh_pixelmap_getbytesnumberperrow)
2930
2931
2932### OH_PixelMap_GetDensity()
2933
2934```
2935int32_t OH_PixelMap_GetDensity (const NativePixelMap * native, int32_t * density )
2936```
2937
2938**Description**
2939
2940Obtains the pixel density of a **NativePixelMap** object.
2941
2942**Since**: 10
2943
2944**Parameters**
2945
2946| Name| Description|
2947| -------- | -------- |
2948| native | Pointer to a **NativePixelMap** object.|
2949| density | Pointer to the pixel density.|
2950
2951**Returns**
2952
2953For details, see [IRNdkErrCode](#irndkerrcode-1).
2954
2955Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2956
2957Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2958
2959Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2960
2961Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2962
2963Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2964
2965Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2966
2967**See**
2968
2969[GetDensity](image.md#oh_pixelmap_getdensity)
2970
2971
2972### OH_PixelMap_GetImageInfo()
2973
2974```
2975int32_t OH_PixelMap_GetImageInfo (const NativePixelMap * native, OhosPixelMapInfos * info )
2976```
2977
2978**Description**
2979
2980Obtains the image information of a **NativePixelMap** object.
2981
2982**Since**: 10
2983
2984**Parameters**
2985
2986| Name| Description|
2987| -------- | -------- |
2988| native | Pointer to a **NativePixelMap** object.|
2989| info | Pointer to the image information.|
2990
2991**Returns**
2992
2993For details, see [IRNdkErrCode](#irndkerrcode-1).
2994
2995Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2996
2997Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2998
2999Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3000
3001Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3002
3003Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3004
3005Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3006
3007Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3008
3009Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3010
3011Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3012
3013Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3014
3015Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3016
3017Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3018
3019Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3020
3021Returns **IMAGE_RESULT_CROP** if cropping fails.
3022
3023Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3024
3025Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3026
3027Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3028
3029Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3030
3031Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3032
3033Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3034
3035**See**
3036
3037[OhosPixelMapInfos](_ohos_pixel_map_infos.md)
3038
3039
3040### OH_PixelMap_GetIsEditable()
3041
3042```
3043int32_t OH_PixelMap_GetIsEditable (const NativePixelMap * native, int32_t * editable )
3044```
3045
3046**Description**
3047
3048Checks whether a **NativePixelMap** object is editable.
3049
3050**Since**: 10
3051
3052**Parameters**
3053
3054| Name| Description|
3055| -------- | -------- |
3056| native | Pointer to a **NativePixelMap** object.|
3057| editable | Pointer to the editing type of the **NativePixelMap** object.|
3058
3059**Returns**
3060
3061For details, see [IRNdkErrCode](#irndkerrcode-1).
3062
3063Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3064
3065Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3066
3067Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3068
3069Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3070
3071Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3072
3073Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3074
3075**See**
3076
3077[GetIsEditable](image.md#oh_pixelmap_getiseditable)
3078
3079
3080### OH_PixelMap_InitNativePixelMap()
3081
3082```
3083NativePixelMap* OH_PixelMap_InitNativePixelMap (napi_env env, napi_value source )
3084```
3085
3086**Description**
3087
3088Initializes a **PixelMap** object.
3089
3090**Since**: 10
3091
3092**Parameters**
3093
3094| Name| Description|
3095| -------- | -------- |
3096| env | Pointer to the NAPI environment.|
3097| source | Options for setting the **PixelMap** object.|
3098
3099**Returns**
3100
3101Returns a pointer to the **NativePixelMap** object if the operation is successful; returns an error code otherwise.
3102
3103**See**
3104
3105[InitNativePixelMap](image.md#oh_pixelmap_initnativepixelmap)
3106
3107
3108### OH_PixelMap_IsSupportAlpha()
3109
3110```
3111int32_t OH_PixelMap_IsSupportAlpha (const NativePixelMap * native, int32_t * alpha )
3112```
3113
3114**Description**
3115
3116Checks whether a **NativePixelMap** object supports alpha channels.
3117
3118**Since**: 10
3119
3120**Parameters**
3121
3122| Name| Description|
3123| -------- | -------- |
3124| native | Pointer to a **NativePixelMap** object.|
3125| alpha | Pointer to the support for alpha channels.|
3126
3127**Returns**
3128
3129For details, see [IRNdkErrCode](#irndkerrcode-1).
3130
3131Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3132
3133Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3134
3135Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3136
3137Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3138
3139Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3140
3141Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3142
3143**See**
3144
3145[IsSupportAlpha](image.md#oh_pixelmap_issupportalpha)
3146
3147
3148### OH_PixelMap_Rotate()
3149
3150```
3151int32_t OH_PixelMap_Rotate (const NativePixelMap * native, float angle )
3152```
3153
3154**Description**
3155
3156Rotates a **NativePixelMap** object.
3157
3158**Since**: 10
3159
3160**Parameters**
3161
3162| Name| Description|
3163| -------- | -------- |
3164| native | Pointer to a **NativePixelMap** object.|
3165| angle | Angle to rotate.|
3166
3167**Returns**
3168
3169For details, see [IRNdkErrCode](#irndkerrcode-1).
3170
3171Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3172
3173Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3174
3175Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3176
3177Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3178
3179Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3180
3181Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3182
3183Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3184
3185Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3186
3187Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3188
3189Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3190
3191Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3192
3193Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3194
3195Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3196
3197Returns **IMAGE_RESULT_CROP** if cropping fails.
3198
3199Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3200
3201Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3202
3203Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3204
3205Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3206
3207Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3208
3209Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3210
3211**See**
3212
3213[Rotate](image.md#oh_pixelmap_rotate)
3214
3215
3216### OH_PixelMap_Scale()
3217
3218```
3219int32_t OH_PixelMap_Scale (const NativePixelMap * native, float x, float y )
3220```
3221
3222**Description**
3223
3224Scales a **NativePixelMap** object.
3225
3226**Since**: 10
3227
3228**Parameters**
3229
3230| Name| Description|
3231| -------- | -------- |
3232| native | Pointer to a **NativePixelMap** object.|
3233| x | Scaling ratio of the width.|
3234| y | Scaling ratio of the height.|
3235
3236**Returns**
3237
3238For details, see [IRNdkErrCode](#irndkerrcode-1).
3239
3240Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3241
3242Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3243
3244Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3245
3246Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3247
3248Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3249
3250Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3251
3252Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3253
3254Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3255
3256Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3257
3258Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3259
3260Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3261
3262Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3263
3264Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3265
3266Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
3267
3268Returns **IMAGE_RESULT_CROP** if cropping fails.
3269
3270Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3271
3272Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3273
3274Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3275
3276Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3277
3278Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3279
3280Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3281
3282
3283**See**
3284
3285[Scale](image.md#oh_pixelmap_scale)
3286
3287
3288### OH_PixelMap_SetAlphaAble()
3289
3290```
3291int32_t OH_PixelMap_SetAlphaAble (const NativePixelMap * native, int32_t alpha )
3292```
3293
3294**Description**
3295
3296Sets an alpha channel for a **NativePixelMap** object.
3297
3298**Since**: 10
3299
3300**Parameters**
3301
3302| Name| Description|
3303| -------- | -------- |
3304| native | Pointer to a **NativePixelMap** object.|
3305| alpha | Alpha channel to set.|
3306
3307**Returns**
3308
3309For details, see [IRNdkErrCode](#irndkerrcode-1).
3310
3311Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3312
3313Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3314
3315Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3316
3317Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3318
3319Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3320
3321Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3322
3323
3324**See**
3325
3326[SetAlphaAble](image.md#oh_pixelmap_setalphaable)
3327
3328
3329### OH_PixelMap_SetDensity()
3330
3331```
3332int32_t OH_PixelMap_SetDensity (const NativePixelMap * native, int32_t density )
3333```
3334
3335**Description**
3336
3337Sets the pixel density for a **NativePixelMap** object.
3338
3339**Since**: 10
3340
3341**Parameters**
3342
3343| Name| Description|
3344| -------- | -------- |
3345| native | Pointer to a **NativePixelMap** object.|
3346| density | Pixel density to set.|
3347
3348**Returns**
3349
3350For details, see [IRNdkErrCode](#irndkerrcode-1).
3351
3352Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3353
3354Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3355
3356Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3357
3358Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3359
3360Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3361
3362Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3363
3364**See**
3365
3366[GetDensity](oh_pixelmap_getdensity)
3367
3368
3369### OH_PixelMap_SetOpacity()
3370
3371```
3372int32_t OH_PixelMap_SetOpacity (const NativePixelMap * native, float opacity )
3373```
3374
3375**Description**
3376
3377Sets the opacity for a **NativePixelMap** object.
3378
3379**Since**: 10
3380
3381**Parameters**
3382
3383| Name| Description|
3384| -------- | -------- |
3385| native | Pointer to a **NativePixelMap** object.|
3386| opacity | Opacity to set.|
3387
3388**Returns**
3389
3390For details, see [IRNdkErrCode](#irndkerrcode-1).
3391
3392Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3393
3394Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3395
3396Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3397
3398Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3399
3400Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3401
3402Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3403
3404**See**
3405
3406[SetOpacity](image.md#oh_pixelmap_setopacity)
3407
3408
3409### OH_PixelMap_Translate()
3410
3411```
3412int32_t OH_PixelMap_Translate (const NativePixelMap * native, float x, float y )
3413```
3414
3415**Description**
3416
3417Translates a **NativePixelMap** object.
3418
3419**Since**: 10
3420
3421**Parameters**
3422
3423| Name| Description|
3424| -------- | -------- |
3425| native | Pointer to a **NativePixelMap** object.|
3426| x | Horizontal distance to translate.|
3427| y | Vertical distance to translate.|
3428
3429**Returns**
3430
3431For details, see [IRNdkErrCode](#irndkerrcode-1).
3432
3433Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3434
3435Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3436
3437Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3438
3439Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3440
3441Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3442
3443Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3444
3445Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3446
3447Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3448
3449Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3450
3451Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3452
3453Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3454
3455Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3456
3457Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3458
3459Returns **IMAGE_RESULT_CROP** if cropping fails.
3460
3461Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3462
3463Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3464
3465Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3466
3467Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3468
3469Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3470
3471Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3472
3473**See**
3474
3475[Translate](image.md#oh_pixelmap_translate)
3476
3477
3478### OH_PixelMap_UnAccessPixels()
3479
3480```
3481int32_t OH_PixelMap_UnAccessPixels (const NativePixelMap * native)
3482```
3483
3484**Description**
3485
3486Unlocks the memory of a **NativePixelMap** object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs.
3487
3488**Since**: 10
3489
3490**Parameters**
3491
3492| Name| Description|
3493| -------- | -------- |
3494| native | Pointer to a **NativePixelMap** object.|
3495
3496**Returns**
3497
3498For details, see [IRNdkErrCode](#irndkerrcode-1).
3499
3500Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3501
3502Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3503
3504Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3505
3506Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3507
3508Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3509
3510Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3511
3512Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3513
3514Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3515
3516Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3517
3518Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3519
3520Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3521
3522Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3523
3524Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3525
3526Returns **IMAGE_RESULT_CROP** if cropping fails.
3527
3528Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3529
3530Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3531
3532Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3533
3534Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3535
3536Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3537
3538Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3539
3540
3541**See**
3542
3543[UnAccessPixels](image.md#oh_pixelmap_unaccesspixels)
3544
3545
3546### OH_UnAccessPixels()
3547
3548```
3549int32_t OHOS::Media::OH_UnAccessPixels (napi_env env, napi_value value )
3550```
3551
3552**Description**
3553
3554Unlocks the memory of a **PixelMap** object. This function is used with **OH_AccessPixels** in pairs.
3555
3556**Since**: 8
3557
3558**Deprecated from**: 10
3559
3560**Parameters**
3561
3562| Name| Description|
3563| -------- | -------- |
3564| env | Pointer to the NAPI environment.|
3565| value | **PixelMap** object at the application layer.|
3566
3567**Returns**
3568
3569Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful; returns an error code otherwise.
3570
3571**See**
3572
3573[AccessPixels](image.md#oh_accesspixels)
3574
3575
3576## Variable Description
3577
3578
3579### alphaType
3580
3581```
3582int32_t OhosImageSourceInfo::alphaType
3583```
3584
3585**Description**
3586
3587Defines the alpha type of the image source.
3588
3589**Since**: 10
3590
3591
3592### buffer [1/2]
3593
3594```
3595uint8_t* OhosImageSource::buffer = nullptr
3596```
3597
3598**Description**
3599
3600Defines a pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.
3601
3602**Since**: 10
3603
3604### buffer [2/2]
3605
3606```
3607uint8_t* OhosImageSourceUpdateData::buffer = nullptr
3608```
3609
3610**Description**
3611
3612Defines a pointer to the buffer for storing the update data.
3613
3614**Since**: 10
3615
3616
3617### bufferSize [1/2]
3618
3619```
3620size_t OhosImageSource::bufferSize = 0
3621```
3622
3623**Description**
3624
3625Defines the size of the image source buffer.
3626
3627
3628### bufferSize [2/2]
3629
3630```
3631size_t OhosImageSourceUpdateData::bufferSize = 0
3632```
3633
3634**Description**
3635
3636Defines the size of the buffer.
3637
3638**Since**: 10
3639
3640
3641### colorSpace
3642
3643```
3644int32_t OhosImageSourceInfo::colorSpace
3645```
3646
3647**Description**
3648
3649Defines the color space of the image source.
3650
3651**Since**: 10
3652
3653
3654### delayTimeList
3655
3656```
3657int32_t* OhosImageSourceDelayTimeList::delayTimeList
3658```
3659
3660**Description**
3661
3662Defines a pointer to the head of the image source delay time list.
3663
3664**Since**: 10
3665
3666
3667### density [1/2]
3668
3669```
3670int32_t OhosImageSourceOps::density
3671```
3672
3673**Description**
3674
3675Defines the pixel density of the image source.
3676
3677**Since**: 10
3678
3679
3680### density [2/2]
3681
3682```
3683int32_t OhosImageSourceInfo::density
3684```
3685
3686**Description**
3687
3688Defines the image density of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).
3689
3690**Since**: 10
3691
3692
3693### editable
3694
3695```
3696int8_t OhosImageDecodingOps::editable
3697```
3698
3699**Description**
3700
3701Defines whether the output pixel map is editable.
3702
3703**Since**: 10
3704
3705
3706### fd
3707
3708```
3709int32_t OhosImageSource::fd = -1
3710```
3711
3712**Description**
3713
3714Defines the descriptor of the image source.
3715
3716**Since**: 10
3717
3718
3719### fitDensity
3720
3721```
3722int32_t OhosImageDecodingOps::fitDensity
3723```
3724
3725**Description**
3726
3727Defines the pixel density of the output pixel map.
3728
3729**Since**: 10
3730
3731
3732### format
3733
3734```
3735char* OhosImageSourceSupportedFormat::format = nullptr
3736```
3737
3738**Description**
3739
3740Defines a pointer to the head of the format string.
3741
3742**Since**: 10
3743
3744
3745### height
3746
3747```
3748int32_t OhosImageRegion::height
3749```
3750
3751**Description**
3752
3753Defines the height of the region, in pixels.
3754
3755**Since**: 10
3756
3757### index
3758
3759```
3760uint32_t OhosImageDecodingOps::index
3761```
3762
3763**Description**
3764
3765Defines the index of the output pixel map.
3766
3767**Since**: 10
3768
3769
3770### isCompleted
3771
3772```
3773int8_t OhosImageSourceUpdateData::isCompleted = 0
3774```
3775
3776**Description**
3777
3778Defines whether the image source data update is completed.
3779
3780**Since**: 10
3781
3782
3783### offset
3784
3785```
3786uint32_t OhosImageSourceUpdateData::offset = 0
3787```
3788
3789**Description**
3790
3791Defines the offset of the update data in the buffer.
3792
3793**Since**: 10
3794
3795
3796### OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE
3797
3798```
3799const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample"
3800```
3801
3802**Description**
3803
3804Defines a pointer to bits per sample, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3805
3806**Since**: 10
3807
3808
3809### OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL
3810
3811```
3812const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel"
3813```
3814
3815**Description**
3816
3817Defines a pointer to the compressed bits per pixel, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3818
3819**Since**: 10
3820
3821
3822### OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL
3823
3824```
3825const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal"
3826```
3827
3828**Description**
3829
3830Defines a pointer to the created date and time, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3831
3832**Since**: 10
3833
3834
3835### OHOS_IMAGE_PROPERTY_EXPOSURE_TIME
3836
3837```
3838const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime"
3839```
3840
3841**Description**
3842
3843Defines a pointer to the exposure time, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3844
3845**Since**: 10
3846
3847
3848### OHOS_IMAGE_PROPERTY_F_NUMBER
3849
3850```
3851const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber"
3852```
3853
3854**Description**
3855
3856Defines a pointer to the f-number of the image, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3857
3858**Since**: 10
3859
3860
3861### OHOS_IMAGE_PROPERTY_GPS_LATITUDE
3862
3863```
3864const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude"
3865```
3866
3867**Description**
3868
3869Defines a pointer to the GPS latitude, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3870
3871**Since**: 10
3872
3873
3874### OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF
3875
3876```
3877const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef"
3878```
3879
3880**Description**
3881
3882Defines a pointer to the GPS latitude reference information, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3883
3884**Since**: 10
3885
3886
3887### OHOS_IMAGE_PROPERTY_GPS_LONGITUDE
3888
3889```
3890const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude"
3891```
3892
3893**Description**
3894
3895Defines a pointer to the GPS longitude, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3896
3897**Since**: 10
3898
3899
3900### OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF
3901
3902```
3903const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef"
3904```
3905
3906**Description**
3907
3908Defines a pointer to the GPS longitude reference information, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3909
3910**System capability**: SystemCapability.Multimedia.Image
3911
3912**Since**: 10
3913
3914
3915### OHOS_IMAGE_PROPERTY_IMAGE_LENGTH
3916
3917```
3918const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength"
3919```
3920
3921**Description**
3922
3923Defines a pointer to the image length, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3924
3925**Since**: 10
3926
3927
3928### OHOS_IMAGE_PROPERTY_IMAGE_WIDTH
3929
3930```
3931const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth"
3932```
3933
3934**Description**
3935
3936Defines a pointer to the image width, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3937
3938**System capability**: SystemCapability.Multimedia.Image
3939
3940**Since**: 10
3941
3942
3943### OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS
3944
3945```
3946const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings"
3947```
3948
3949**Description**
3950
3951Defines a pointer to the ISO speed ratings, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3952
3953**Since**: 10
3954
3955
3956### OHOS_IMAGE_PROPERTY_ORIENTATION
3957
3958```
3959const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation"
3960```
3961
3962**Description**
3963
3964Defines a pointer to the orientation, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3965
3966**Since**: 10
3967
3968
3969### OHOS_IMAGE_PROPERTY_SCENE_TYPE
3970
3971```
3972const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType"
3973```
3974
3975**Description**
3976
3977Defines a pointer to the scene type, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3978
3979**Since**: 10
3980
3981
3982### pixelFormat [1/3]
3983
3984```
3985int32_t OhosImageSourceOps::pixelFormat
3986```
3987
3988**Description**
3989
3990Defines the pixel format of the image source. It is usually used to describe the YUV buffer.
3991
3992**Since**: 10
3993
3994
3995### pixelFormat [2/3]
3996
3997```
3998int32_t OhosImageDecodingOps::pixelFormat
3999```
4000
4001**Description**
4002
4003Defines the pixel format of the output pixel map.
4004
4005**Since**: 10
4006
4007
4008### pixelFormat [3/3]
4009
4010```
4011int32_t OhosImageSourceInfo::pixelFormat
4012```
4013
4014**Description**
4015
4016Defines the pixel format of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).
4017
4018**Since**: 10
4019
4020
4021### region
4022
4023```
4024struct OhosImageRegion OhosImageDecodingOps::region
4025```
4026
4027**Description**
4028
4029Defines the region of the output pixel map.
4030
4031**Since**: 10
4032
4033
4034### rotate
4035
4036```
4037uint32_t OhosImageDecodingOps::rotate
4038```
4039
4040**Description**
4041
4042Defines the decoding rotation options.
4043
4044**Since**: 10
4045
4046
4047### sampleSize
4048
4049```
4050uint32_t OhosImageDecodingOps::sampleSize
4051```
4052
4053**Description**
4054
4055Defines the size of the sample.
4056
4057**Since**: 10
4058
4059
4060### size [1/7]
4061
4062```
4063struct OhosImageSize OhosImageSourceOps::size
4064```
4065
4066**Description**
4067
4068Defines the pixel width and height of the image source.
4069
4070**Since**: 10
4071
4072
4073### size [2/7]
4074
4075```
4076struct OhosImageSize OhosImageDecodingOps::size
4077```
4078
4079**Description**
4080
4081Defines the pixel width and height of the output pixel map.
4082
4083**Since**: 10
4084
4085
4086### size [3/7]
4087
4088```
4089struct OhosImageSize OhosImageSourceInfo::size
4090```
4091
4092**Description**
4093
4094Defines the pixel width and height of the image source.
4095
4096**Since**: 10
4097
4098
4099### size [4/7]
4100
4101```
4102size_t OhosImageSourceDelayTimeList::size = 0
4103```
4104
4105**Description**
4106
4107Defines the size of the image source delay time list.
4108
4109**Since**: 10
4110
4111
4112### size [5/7]
4113
4114```
4115size_t OhosImageSourceSupportedFormat::size = 0
4116```
4117
4118**Description**
4119
4120Defines the size of the format string.
4121
4122**Since**: 10
4123
4124
4125### size [6/7]
4126
4127```
4128size_t OhosImageSourceSupportedFormatList::size = 0
4129```
4130
4131**Description**
4132
4133Defines the size of the format string list.
4134
4135**Since**: 10
4136
4137
4138### size [7/7]
4139
4140```
4141size_t OhosImageSourceProperty::size = 0
4142```
4143
4144**Description**
4145
4146Defines the size of the property string.
4147
4148**Since**: 10
4149
4150
4151### supportedFormatList
4152
4153```
4154struct OhosImageSourceSupportedFormat** OhosImageSourceSupportedFormatList::supportedFormatList = nullptr
4155```
4156
4157**Description**
4158
4159Defines a double pointer to the head of the format string list.
4160
4161**Since**: 10
4162
4163
4164### updateLength
4165
4166```
4167uint32_t OhosImageSourceUpdateData::updateLength = 0
4168```
4169
4170**Description**
4171
4172Defines the length of the update data in the buffer.
4173
4174**Since**: 10
4175
4176
4177### uri
4178
4179```
4180char* OhosImageSource::uri = nullptr
4181```
4182
4183**Description**
4184
4185Defines a pointer to the image source URI. Only a file URI or Base64 URI is accepted.
4186
4187**Since**: 10
4188
4189
4190### uriSize
4191
4192```
4193size_t OhosImageSource::uriSize = 0
4194```
4195
4196**Description**
4197
4198Defines the length of the image source URI.
4199
4200**Since**: 10
4201
4202
4203### value
4204
4205```
4206char* OhosImageSourceProperty::value = nullptr
4207```
4208
4209**Description**
4210
4211Defines a pointer to the head of the property string.
4212
4213**Since**: 10
4214
4215
4216### width
4217
4218```
4219int32_t OhosImageRegion::width
4220```
4221
4222**Description**
4223
4224Defines the width of the region, in pixels.
4225
4226**Since**: 10
4227
4228
4229### x
4230
4231```
4232int32_t OhosImageRegion::x
4233```
4234
4235**Description**
4236
4237Defines the X coordinate of the start point, in pixels.
4238
4239**Since**: 10
4240
4241
4242### y
4243
4244```
4245int32_t OhosImageRegion::y
4246```
4247
4248**Description**
4249
4250Defines the Y coordinate of the start point, in pixels.
4251
4252**Since**: 10
4253