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