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