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