/* automatically generated by rust-bindgen 0.65.1 */
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(clippy::missing_safety_doc)]
// bindgen's bitfield accessors transmute/cast between identical types.
#![allow(clippy::useless_transmute)]
#![allow(clippy::unnecessary_cast)]
use napi_sys_ohos::*;
use ohos_resource_manager_sys::*;
#[link(name = "ohimage")]
#[link(name = "image_packer")]
#[link(name = "picture")]
#[link(name = "image_receiver")]
#[link(name = "image_source")]
#[link(name = "pixelmap")]
#[link(name = "image_ndk.z")]
#[link(name = "image_packer_ndk.z")]
#[link(name = "image_receiver_ndk.z")]
#[link(name = "image_source_ndk.z")]
#[link(name = "pixelmap_ndk.z")]
unsafe extern "C" {}
#[doc = " @brief Defines the image size.\n\n @since 10\n @version 2.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSize {
#[doc = " Image width, in pixels."]
pub width: i32,
#[doc = " Image height, in pixels."]
pub height: i32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ImageNative_ {
_unused: [u8; 0],
}
#[doc = " @brief Defines an image object at the native layer for the image interface.\n\n @since 10\n @version 2.0"]
pub type ImageNative = ImageNative_;
#[doc = " @brief Defines the information about an image rectangle.\n\n @since 10\n @version 2.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageRect {
#[doc = " X coordinate of the rectangle."]
pub x: i32,
#[doc = " Y coordinate of the rectangle."]
pub y: i32,
#[doc = " Width of the rectangle, in pixels."]
pub width: i32,
#[doc = " Height of the rectangle, in pixels."]
pub height: i32,
}
#[doc = " @brief Defines the image composition information.\n\n @since 10\n @version 2.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageComponent {
#[doc = " Buffer that stores the pixel data."]
pub byteBuffer: *mut u8,
#[doc = " Size of the pixel data in the memory."]
pub size: usize,
#[doc = " Type of the pixel data."]
pub componentType: i32,
#[doc = " Row stride of the pixel data."]
pub rowStride: i32,
#[doc = " Pixel stride of the pixel data"]
pub pixelStride: i32,
}
extern "C" {
#[doc = " @brief Parses an {@link ImageNative} object at the native layer from a JavaScript native API <b>image </b> object.\n\n @param env Indicates the pointer to the Java Native Interface (JNI) environment.\n @param source Indicates a JavaScript native API <b>image </b> object.\n @return Returns an {@link ImageNative} pointer object if the operation is successful\n returns a null pointer otherwise.\n @see ImageNative, OH_Image_Release\n @since 10\n @version 2.0"]
pub fn OH_Image_InitImageNative(env: napi_env, source: napi_value) -> *mut ImageNative;
}
extern "C" {
#[doc = " @brief Obtains {@link OhosImageRect} of an {@link ImageNative} at the native layer.\n\n @param native Indicates the pointer to an {@link ImageNative} object at the native layer.\n @param rect Indicates the pointer to the {@link OhosImageRect} object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n @see ImageNative, OhosImageRect\n @since 10\n @version 2.0"]
pub fn OH_Image_ClipRect(native: *const ImageNative, rect: *mut OhosImageRect) -> i32;
}
extern "C" {
#[doc = " @brief Obtains {@link OhosImageSize} of an {@link ImageNative} object at the native layer.\n\n @param native Indicates the pointer to an {@link ImageNative} object at the native layer.\n @param size Indicates the pointer to the {@link OhosImageSize} object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n @see ImageNative, OhosImageSize\n @since 10\n @version 2.0"]
pub fn OH_Image_Size(native: *const ImageNative, size: *mut OhosImageSize) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the image format of an {@link ImageNative} object at the native layer.\n\n @param native Indicates the pointer to an {@link ImageNative} object at the native layer.\n @param format Indicates the pointer to the image format obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n @see ImageNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Format(native: *const ImageNative, format: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Obtains {@link OhosImageComponent} of an {@link ImageNative} object at the native layer.\n\n @param native Indicates the pointer to an {@link ImageNative} object at the native layer.\n @param componentType Indicates the type of the required component.\n @param componentNative Indicates the pointer to the {@link OhosImageComponent} object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n @see ImageNative, OhosImageComponent\n @since 10\n @version 2.0"]
pub fn OH_Image_GetComponent(
native: *const ImageNative,
componentType: i32,
componentNative: *mut OhosImageComponent,
) -> i32;
}
extern "C" {
#[doc = " @brief Releases an {@link ImageNative} object at the native layer.\n Note: This API is not used to release a JavaScript native API <b>Image</b> object.\n It is used to release the object {@link ImageNative} at the native layer\n parsed by calling {@link OH_Image_InitImageNative}.\n\n @param native Indicates the pointer to an {@link ImageNative} object at the native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n @see ImageNative, OH_Image_InitImageNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Release(native: *mut ImageNative) -> i32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ImagePacker_Native_ {
_unused: [u8; 0],
}
#[doc = " @brief Defines an image packer object at the native layer for the image packer interface.\n\n @since 11\n @version 4.1"]
pub type ImagePacker_Native = ImagePacker_Native_;
#[doc = " @brief Defines the image packing options.\n\n @since 11\n @version 4.1"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ImagePacker_Opts_ {
#[doc = " Encoding format."]
pub format: *const ::std::os::raw::c_char,
#[doc = " Encoding quality."]
pub quality: ::std::os::raw::c_int,
}
#[doc = " @brief Defines alias of image packing options.\n\n @since 11\n @version 4.1"]
pub type ImagePacker_Opts = ImagePacker_Opts_;
extern "C" {
#[doc = " @brief Creates an <b>ImagePacker</b> object at the JavaScript native layer.\n\n @param env Indicates a pointer to the JavaScript Native Interface (JNI) environment.\n @param res Indicates a pointer to the <b>ImagePacker</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n\n @since 11\n @version 4.1"]
pub fn OH_ImagePacker_Create(env: napi_env, res: *mut napi_value) -> i32;
}
extern "C" {
#[doc = " @brief Parses an {@link ImagePacker_Native} object at the native layer\n from a JavaScript native API <b>ImagePacker</b> object.\n\n @param env Indicates the pointer to the JavaScript Native Interface (JNI) environment.\n @param packer Indicates a JavaScript native API <b>ImagePacker</b> object.\n @return Returns an {@link ImagePacker_Native} pointer object if the operation is successful\n returns a null pointer otherwise.\n @see {@link OH_ImagePacker_Release}\n @since 11\n @version 4.1"]
pub fn OH_ImagePacker_InitNative(env: napi_env, packer: napi_value) -> *mut ImagePacker_Native;
}
extern "C" {
#[doc = " @brief Encoding an <b>ImageSource</b> or a <b>PixelMap</b> into the data with required format\n\n @param native Indicates the pointer to an {@link ImagePacker} object at the native layer.\n @param source Indicates an encoding source, a JS pixel map object or a JS image source object .\n @param opts Indicates the encoding {@link ImagePacker_Opts} .\n @param outData Indicates the pointer to the encoded data.\n @param size Indicates the pointer to the {@link OhosImageComponent} object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} ERR_IMAGE_DATA_ABNORMAL - if output target abnormal\n returns {@link IRNdkErrCode} ERR_IMAGE_MISMATCHED_FORMAT - if format mismatched\n returns {@link IRNdkErrCode} ERR_IMAGE_MALLOC_ABNORMAL - if malloc internal buffer error\n returns {@link IRNdkErrCode} ERR_IMAGE_DECODE_ABNORMAL - if init codec internal error\n returns {@link IRNdkErrCode} ERR_IMAGE_ENCODE_FAILED - if encoder occur error during encoding\n @see {@link OH_ImagePacker_PackToFile}\n @since 11\n @version 4.1"]
pub fn OH_ImagePacker_PackToData(
native: *mut ImagePacker_Native,
source: napi_value,
opts: *mut ImagePacker_Opts,
outData: *mut u8,
size: *mut usize,
) -> i32;
}
extern "C" {
#[doc = " @brief Encoding an <b>ImageSource</b> or a <b>PixelMap</b> into the a file with fd with required format\n\n @param native Indicates the pointer to an {@link ImagePacker} object at the native layer.\n @param source Indicates an encoding source, a JS pixel map object or a JS image source object .\n @param opts Indicates the encoding {@link ImagePacker_Opts} .\n @param fd Indicates the a writable file descriptor.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} ERR_IMAGE_DATA_ABNORMAL - if output target abnormal\n returns {@link IRNdkErrCode} ERR_IMAGE_MISMATCHED_FORMAT - if format mismatched\n returns {@link IRNdkErrCode} ERR_IMAGE_MALLOC_ABNORMAL - if malloc internal buffer error\n returns {@link IRNdkErrCode} ERR_IMAGE_DECODE_ABNORMAL - if init codec internal error\n returns {@link IRNdkErrCode} ERR_IMAGE_ENCODE_FAILED - if encoder occur error during encoding\n @see {@link OH_ImagePacker_PackToData}\n @since 11\n @version 4.1"]
pub fn OH_ImagePacker_PackToFile(
native: *mut ImagePacker_Native,
source: napi_value,
opts: *mut ImagePacker_Opts,
fd: ::std::os::raw::c_int,
) -> i32;
}
extern "C" {
#[doc = " @brief Releases an {@link ImagePacker_Native} object at the native layer.\n Note: This API is not used to release a JavaScript native API <b>ImagePacker</b> object.\n It is used to release the object {@link ImagePacker_Native} at the native layer\n parsed by calling {@link OH_ImagePacker_InitNative}.\n\n @param native Indicates the pointer to an {@link ImagePacker_Native} object at the native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n @see {@link OH_ImagePacker_InitNative}\n @since 11\n @version 4.1"]
pub fn OH_ImagePacker_Release(native: *mut ImagePacker_Native) -> i32;
}
#[doc = " @brief Defines the native pixel map information.\n @since 10\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NativePixelMap_ {
_unused: [u8; 0],
}
#[doc = " @brief Defines the data type name of the native pixel map.\n @since 10\n @version 1.0"]
pub type NativePixelMap = NativePixelMap_;
#[doc = " @brief Defines the pixel map information.\n\n @since 10\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosPixelMapInfos {
#[doc = " Image width, in pixels."]
pub width: u32,
#[doc = " Image height, in pixels."]
pub height: u32,
#[doc = " Number of bytes per row."]
pub rowSize: u32,
#[doc = " Pixel format."]
pub pixelFormat: i32,
}
#[doc = " Nearest-neighbor interpolation."]
pub const OH_PixelMap_AntiAliasingLevel_OH_PixelMap_AntiAliasing_NONE:
OH_PixelMap_AntiAliasingLevel = 0;
#[doc = " Bilinear interpolation, without mipmap linear filtering."]
pub const OH_PixelMap_AntiAliasingLevel_OH_PixelMap_AntiAliasing_LOW:
OH_PixelMap_AntiAliasingLevel = 1;
#[doc = " Bilinear interpolation, with mipmap linear filtering."]
pub const OH_PixelMap_AntiAliasingLevel_OH_PixelMap_AntiAliasing_MEDIUM:
OH_PixelMap_AntiAliasingLevel = 2;
#[doc = " Cubic interpolation."]
pub const OH_PixelMap_AntiAliasingLevel_OH_PixelMap_AntiAliasing_HIGH:
OH_PixelMap_AntiAliasingLevel = 3;
#[doc = " @brief Enumerates the anti-aliasing level.\n\n @since 12\n @version 1.0"]
pub type OH_PixelMap_AntiAliasingLevel = u32;
#[doc = " @brief Defines the options used for creating a pixel map.\n\n @since 10\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosPixelMapCreateOps {
#[doc = " Image width, in pixels."]
pub width: u32,
#[doc = " Image height, in pixels."]
pub height: u32,
#[doc = " Image format."]
pub pixelFormat: i32,
#[doc = " Editing type of the image."]
pub editable: u32,
#[doc = " Alpha type of the image."]
pub alphaType: u32,
#[doc = " Scale mode of the image."]
pub scaleMode: u32,
}
extern "C" {
#[doc = " @brief Creates a PixelMap object. Currently, only BGRA input streams are supported.\n\n @param env Pointer to the NAPI environment.\n @param info Options for setting the PixelMap object.\n @param buf Pointer to the buffer of the image.\n @param len Image size.\n @param res Pointer to the PixelMap object at the application layer.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}: An error occurs during decoding of the image header.</li>\n <li>{@link IMAGE_RESULT_CREATE_DECODER_FAILED}: The decoder fails to be created.</li>\n <li>{@link IMAGE_RESULT_CREATE_ENCODER_FAILED}: The encoder fails to be created.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_DECODE_ABNORMAL}: Image decoding fails.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_INIT_ABNORMAL}: The image fails to be initialized.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ENCODE_FAILED}: The image fails to be encoded.</li>\n <li>{@link IMAGE_RESULT_HW_DECODE_UNSUPPORT}: Hardware decoding is not supported.</li>\n <li>{@link IMAGE_RESULT_HW_DECODE_FAILED}: Hardware decoding fails.</li>\n <li>{@link IMAGE_RESULT_INDEX_INVALID}: Index fails.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see CreatePixelMap\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_CreatePixelMap(
env: napi_env,
info: OhosPixelMapCreateOps,
buf: *mut ::std::os::raw::c_void,
len: usize,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates a PixelMap object.\n\n @param env Pointer to the NAPI environment.\n @param info Options for setting the PixelMap object.\n @param buf Pointer to the buffer of the image.\n @param len Buffer size.\n @param rowStride Row stride. The stride is the actual memory size occupied by each row of the image, in bytes.\n Stride = Width \\*Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of\n each row for memory alignment purposes.\n @param res Pointer to the PixelMap object at the application layer.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li></ul>\n @see OH_PixelMap_CreatePixelMapWithStride\n @since 12\n @version 1.0"]
pub fn OH_PixelMap_CreatePixelMapWithStride(
env: napi_env,
info: OhosPixelMapCreateOps,
buf: *mut ::std::os::raw::c_void,
len: usize,
rowStride: i32,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates a PixelMap object that contains only alpha channel information.\n\n @param env Pointer to the NAPI environment.\n @param source PixelMap object at the application layer.\n @param alpha Pointer to the alpha channel.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}: An error occurs during decoding of the image header.</li>\n <li>{@link IMAGE_RESULT_CREATE_DECODER_FAILED}: The decoder fails to be created.</li>\n <li>{@link IMAGE_RESULT_CREATE_ENCODER_FAILED}: The encoder fails to be created.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_DECODE_ABNORMAL}: Image decoding fails.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_INIT_ABNORMAL}: The image fails to be initialized.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ENCODE_FAILED}: The image fails to be encoded.</li>\n <li>{@link IMAGE_RESULT_HW_DECODE_UNSUPPORT}: Hardware decoding is not supported.</li>\n <li>{@link IMAGE_RESULT_HW_DECODE_FAILED}: Hardware decoding fails.</li>\n <li>{@link IMAGE_RESULT_INDEX_INVALID}: Index fails.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see CreateAlphaPixelMap\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_CreateAlphaPixelMap(
env: napi_env,
source: napi_value,
alpha: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Initializes a NativePixelMap object.\n\n @param env Pointer to the NAPI environment.\n @param source PixelMap object at the application layer.\n @return Pointer to the NativePixelMap object.\n @see InitNativePixelMap\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_InitNativePixelMap(env: napi_env, source: napi_value)
-> *mut NativePixelMap;
}
extern "C" {
#[doc = " @brief Obtains the number of bytes per row of a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param num Pointer to the number of bytes per row.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see GetBytesNumberPerRow\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_GetBytesNumberPerRow(native: *const NativePixelMap, num: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Checks whether a NativePixelMap object is editable.\n\n @param native Pointer to a NativePixelMap object.\n @param editable Pointer to the editing type of the NativePixelMap object.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see GetIsEditable\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_GetIsEditable(native: *const NativePixelMap, editable: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Checks whether a NativePixelMap object supports alpha channels.\n\n @param native Pointer to a NativePixelMap object.\n @param alpha Pointer to the support for alpha channels.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see IsSupportAlpha\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_IsSupportAlpha(native: *const NativePixelMap, alpha: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Sets an alpha channel for a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param alpha Alpha channel to set.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see SetAlphaAble\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_SetAlphaAble(native: *const NativePixelMap, alpha: i32) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the pixel density of a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param density Pointer to the pixel density.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see GetDensity\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_GetDensity(native: *const NativePixelMap, density: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Sets the pixel density for a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param density Pixel density to set.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see GetDensity\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_SetDensity(native: *const NativePixelMap, density: i32) -> i32;
}
extern "C" {
#[doc = " @brief Sets the opacity for a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param opacity Opacity to set.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li></ul>\n @see SetOpacity\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_SetOpacity(native: *const NativePixelMap, opacity: f32) -> i32;
}
extern "C" {
#[doc = " @brief Scales a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param x Scale ratio of the width.\n @param y Scale ratio of the height.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_INIT_ABNORMAL}: The image fails to be initialized.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see Scale\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_Scale(native: *const NativePixelMap, x: f32, y: f32) -> i32;
}
extern "C" {
#[doc = " @brief Scales a NativePixelMap object based on the specified anti-aliasing level, width, and height.\n\n @param native Pointer to a NativePixelMap object.\n @param x Scale ratio of the width.\n @param y Scale ratio of the height.\n @param level Anti-aliasing level.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li></ul>\n @see Scale\n @since 12\n @version 1.0"]
pub fn OH_PixelMap_ScaleWithAntiAliasing(
native: *const NativePixelMap,
x: f32,
y: f32,
level: OH_PixelMap_AntiAliasingLevel,
) -> i32;
}
extern "C" {
#[doc = " @brief Translates a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param x Horizontal distance to translate.\n @param y Vertical distance to translate.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see Translate\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_Translate(native: *const NativePixelMap, x: f32, y: f32) -> i32;
}
extern "C" {
#[doc = " @brief Rotates a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param angle Angle to rotate.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see Rotate\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_Rotate(native: *const NativePixelMap, angle: f32) -> i32;
}
extern "C" {
#[doc = " @brief Flips a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param x Whether to flip around the x axis.\n @param y Whether to flip around the y axis.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see Flip\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_Flip(native: *const NativePixelMap, x: i32, y: i32) -> i32;
}
extern "C" {
#[doc = " @brief Crops a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param x X-coordinate of the upper left corner of the target image.\n @param y Y-coordinate of the upper left corner of the target image.\n @param width Width of the cropped region.\n @param height Height of the cropped region.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see Crop\n @since 10\n @version 1.0"]
pub fn OH_PixelMap_Crop(
native: *const NativePixelMap,
x: i32,
y: i32,
width: i32,
height: i32,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the image information of a NativePixelMap object.\n\n @param native Pointer to a NativePixelMap object.\n @param info Pointer to the image information.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see OhosPixelMapInfos\n @since 10\n @version 2.0"]
pub fn OH_PixelMap_GetImageInfo(
native: *const NativePixelMap,
info: *mut OhosPixelMapInfos,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the memory address of a NativePixelMap object and locks the memory.\n\n @param native Pointer to a NativePixelMap object.\n @param addr Double pointer to the memory address.\n @see UnAccessPixels\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @since 10\n @version 2.0"]
pub fn OH_PixelMap_AccessPixels(
native: *const NativePixelMap,
addr: *mut *mut ::std::os::raw::c_void,
) -> i32;
}
extern "C" {
#[doc = " @brief Unlocks the memory of a NativePixelMap object. This function is used with {@link OH_PixelMap_AccessPixels} in\n pairs.\n\n @param native Pointer to a NativePixelMap object.\n @return Result code defined in {@link IRNdkErrCode}:\n <ul><li>{@link IMAGE_RESULT_SUCCESS}: The operation is successful.</li>\n <li>{@link IMAGE_RESULT_BAD_PARAMETER}: A parameter is incorrect.</li>\n <li>{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}: The JNI environment is abnormal.</li>\n <li>{@link IMAGE_RESULT_INVALID_PARAMETER}: A parameter is invalid.</li>\n <li>{@link IMAGE_RESULT_GET_DATA_ABNORMAL}: An error occurs during image data retrieval.</li>\n <li>{@link IMAGE_RESULT_DECODE_FAILED}: Decoding fails.</li>\n <li>{@link IMAGE_RESULT_CHECK_FORMAT_ERROR}: The format check fails.</li>\n <li>{@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}: Skia decoding fails.</li>\n <li>{@link IMAGE_RESULT_DATA_ABNORMAL}: The image input data is incorrect.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}: Sharing the memory fails.</li>\n <li>{@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}: Data in the shared memory is incorrect.</li>\n <li>{@link IMAGE_RESULT_MALLOC_ABNORMAL}: An error occurs during memory allocation.</li>\n <li>{@link IMAGE_RESULT_DATA_UNSUPPORT}: The attribute is invalid or the image data is not supported.</li>\n <li>{@link IMAGE_RESULT_CROP}: Cropping fails.</li>\n <li>{@link IMAGE_RESULT_UNKNOWN_FORMAT}: The image format is unknown.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}: The plugin fails to be registered.</li>\n <li>{@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}: The plugin fails to be created.</li>\n <li>{@link IMAGE_RESULT_ALPHA_TYPE_ERROR}: The alpha type is incorrect.</li>\n <li>{@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}: The memory allocator type is incorrect.</li></ul>\n @see AccessPixels\n @since 10\n @version 2.0"]
pub fn OH_PixelMap_UnAccessPixels(native: *const NativePixelMap) -> i32;
}
#[doc = " @brief Defines an <b>ImageReceiver</b> object at the native layer.\n\n @since 10\n @version 2.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ImageReceiverNative_ {
_unused: [u8; 0],
}
#[doc = " @brief Defines the data type name of a native image receiver.\n\n @since 10\n @version 2.0"]
pub type ImageReceiverNative = ImageReceiverNative_;
#[doc = " @brief Defines the callbacks for images at the native layer.\n\n @since 10\n @version 2.0"]
pub type OH_Image_Receiver_On_Callback = ::std::option::Option<unsafe extern "C" fn()>;
#[doc = " @brief Defines the information about an image receiver.\n\n @since 10\n @version 2.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageReceiverInfo {
pub width: i32,
pub height: i32,
pub format: i32,
pub capicity: i32,
}
extern "C" {
#[doc = " @brief Creates an <b>ImageReceiver</b> object at the application layer.\n\n @param env Indicates the NAPI environment pointer.\n @param info Indicates the options for setting the <b>ImageReceiver</b> object.\n @param res Indicates the pointer to the <b>ImageReceiver</b> object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_SURFACE_FAILED - if create surface failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED - if surface gralloc buffer failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_SURFACE_FAILED - if get sufrace failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT - if media rtsp surface not support.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MEDIA_DATA_UNSUPPORT - if media type unsupported.\n @see OhosImageReceiverInfo\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_CreateImageReceiver(
env: napi_env,
info: OhosImageReceiverInfo,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Initializes an {@link ImageReceiverNative} object at the native layer\n through an <b>ImageReceiver</b> object at the application layer.\n\n @param env Indicates the NAPI environment pointer.\n @param source Indicates an <b>ImageReceiver</b> object.\n @return Returns the pointer to the {@link ImageReceiverNative} object obtained if the operation is successful;\n returns a null pointer otherwise.\n @see ImageReceiverNative, OH_Image_Receiver_Release\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_InitImageReceiverNative(
env: napi_env,
source: napi_value,
) -> *mut ImageReceiverNative;
}
extern "C" {
#[doc = " @brief Obtains the receiver ID through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param id Indicates the pointer to the buffer that stores the ID string obtained.\n @param len Indicates the size of the buffer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_SURFACE_FAILED - if get sufrace failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MEDIA_DATA_UNSUPPORT - if media type unsupported.\n @see ImageReceiverNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_GetReceivingSurfaceId(
native: *const ImageReceiverNative,
id: *mut ::std::os::raw::c_char,
len: usize,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the latest image through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param image Indicates the pointer to an <b>Image</b> object at the application layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_SURFACE_FAILED - if create surface failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED - if surface gralloc buffer failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_SURFACE_FAILED - if get sufrace failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT - if media rtsp surface not support.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED - if request Buffer failed.\n @see ImageReceiverNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_ReadLatestImage(
native: *const ImageReceiverNative,
image: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the next image through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param image Indicates the pointer to an <b>Image</b> object at the application layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED - if Failed to obtain parameters for surface.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_SURFACE_FAILED - if create surface failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED - if surface gralloc buffer failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_SURFACE_FAILED - if get sufrace failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT - if media rtsp surface not support.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED - if request Buffer failed.\n @see ImageReceiverNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_ReadNextImage(
native: *const ImageReceiverNative,
image: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Registers an {@link OH_Image_Receiver_On_Callback} callback event.\n\n This callback event is triggered whenever a new image is received.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param callback Indicates the {@link OH_Image_Receiver_On_Callback} callback event to register.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_SURFACE_FAILED - if get sufrace failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_REGISTER_LISTENER_FAILED - if Failed to register listener.\n returns {@link IRNdkErrCode} IMAGE_RESULT_REGISTER_BUFFER_FAILED - if Failed to register buffer.\n @see ImageReceiverNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_On(
native: *const ImageReceiverNative,
callback: OH_Image_Receiver_On_Callback,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the size of the image receiver through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param size Indicates the pointer to the {@link OhosImageSize} object obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n @see ImageReceiverNative, OH_Image_Receiver_On_Callback\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_GetSize(
native: *const ImageReceiverNative,
size: *mut OhosImageSize,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the capacity of the image receiver through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param capacity Indicates the pointer to the capacity obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n @see ImageReceiverNative, OhosImageSize\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_GetCapacity(
native: *const ImageReceiverNative,
capacity: *mut i32,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the format of the image receiver through an {@link ImageReceiverNative} object.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @param format Indicates the pointer to the format obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image type unsupported.\n @see ImageReceiverNative\n\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_GetFormat(native: *const ImageReceiverNative, format: *mut i32)
-> i32;
}
extern "C" {
#[doc = " @brief Releases an {@link ImageReceiverNative} object at the native layer.\n\n This API is not used to release an <b>ImageReceiver</b> object at the application layer.\n\n @param native Indicates the pointer to an {@link ImageReceiverNative} object at the native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see ImageReceiverNative\n @since 10\n @version 2.0"]
pub fn OH_Image_Receiver_Release(native: *mut ImageReceiverNative) -> i32;
}
#[doc = " @brief Defines a native image source object for the image source APIs.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ImageSourceNative_ {
_unused: [u8; 0],
}
#[doc = " @brief Defines a native image source object for the image source APIs.\n\n @since 10\n @version 4.0"]
pub type ImageSourceNative = ImageSourceNative_;
#[doc = " @brief Defines the region of the image source to decode.\n It is used in {@link OhosImageDecodingOps}, {@link OH_ImageSource_CreatePixelMap}, and\n {@link OH_ImageSource_CreatePixelMapList}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageRegion {
#[doc = " X coordinate of the start point, in pixels."]
pub x: i32,
#[doc = " Y coordinate of the start point, in pixels."]
pub y: i32,
#[doc = " Width of the region, in pixels."]
pub width: i32,
#[doc = " Height of the region, in pixels."]
pub height: i32,
}
#[doc = " @brief Defines image source options information\n {@link OH_ImageSource_Create} and {@link OH_ImageSource_CreateIncremental}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceOps {
#[doc = " Pixel density of the image source."]
pub density: i32,
#[doc = " Image source pixel format, used to describe YUV buffer usually."]
pub pixelFormat: i32,
#[doc = " Image source pixel size of width and height."]
pub size: OhosImageSize,
}
#[doc = " @brief Defines the options for decoding the image source.\n It is used in {@link OH_ImageSource_CreatePixelMap} and {@link OH_ImageSource_CreatePixelMapList}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageDecodingOps {
#[doc = " Defines output pixel map editable."]
pub editable: i8,
#[doc = " Defines output pixel format."]
pub pixelFormat: i32,
#[doc = " Defines decoding target pixel density."]
pub fitDensity: i32,
#[doc = " Defines decoding index of image source."]
pub index: u32,
#[doc = " Defines decoding sample size option."]
pub sampleSize: u32,
#[doc = " Defines decoding rotate option."]
pub rotate: u32,
#[doc = " Defines decoding target pixel size of width and height."]
pub size: OhosImageSize,
#[doc = " Defines image source pixel region for decoding."]
pub region: OhosImageRegion,
}
#[doc = " @brief Defines the image source information, which is obtained by calling {@link OH_ImageSource_GetImageInfo}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceInfo {
#[doc = " Pixel format of the image source. It is set in {@link OH_ImageSource_Create}."]
pub pixelFormat: i32,
#[doc = " Color space of the image source."]
pub colorSpace: i32,
#[doc = " Alpha type of the image source."]
pub alphaType: i32,
#[doc = " Image density of the image source. It is set in {@link OH_ImageSource_Create}."]
pub density: i32,
#[doc = " Pixel width and height of the image source."]
pub size: OhosImageSize,
}
#[doc = " @brief Defines the input resource of the image source. It is obtained by calling {@link OH_ImageSource_Create}.\n Only one type of resource is accepted at a time.\n\n @since 10\n @version 4.0\n @deprecated since 11"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSource {
#[doc = " Pointer to the image source URI. Only a file URI or Base64 URI is accepted.\n @since 10"]
pub uri: *mut ::std::os::raw::c_char,
#[doc = " Length of the image source URI.\n @since 10"]
pub uriSize: usize,
#[doc = " Descriptor of the image source.\n @since 10"]
pub fd: i32,
#[doc = " Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.\n @since 10"]
pub buffer: *mut u8,
#[doc = " Size of the image source buffer.\n @since 10"]
pub bufferSize: usize,
}
#[doc = " @brief Defines the delay time list of the image source. It is obtained by calling\n {@link OH_ImageSource_GetDelayTime}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceDelayTimeList {
#[doc = " Pointer to the head of the image source delay time list.\n @since 10"]
pub delayTimeList: *mut i32,
#[doc = " Size of the image source delay time list.\n @since 10"]
pub size: usize,
}
#[doc = " @brief Defines image source supported format string.\n {@link OhosImageSourceSupportedFormatList} and {@link OH_ImageSource_GetSupportedFormats}\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceSupportedFormat {
#[doc = " Image source supported format string head.\n @since 10"]
pub format: *mut ::std::os::raw::c_char,
#[doc = " Image source supported format string size.\n @since 10"]
pub size: usize,
}
#[doc = " @brief Defines the format string list supported by the image source.\n It is obtained by calling {@link OH_ImageSource_GetSupportedFormats}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceSupportedFormatList {
#[doc = " Image source supported format string list head.\n @since 10"]
pub supportedFormatList: *mut *mut OhosImageSourceSupportedFormat,
#[doc = " Image source supported format string list size.\n @since 10"]
pub size: usize,
}
#[doc = " @brief Defines the property string (in key-value format) of the image source.\n It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceProperty {
#[doc = " Image source property key and value string head.\n @since 10"]
pub value: *mut ::std::os::raw::c_char,
#[doc = " Image source property key and value string size.\n @since 10"]
pub size: usize,
}
#[doc = " @brief Defines the update data of the image source. It is obtained by calling {@link OH_ImageSource_UpdateData}.\n\n @since 10\n @version 4.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OhosImageSourceUpdateData {
#[doc = " Image source update data buffer.\n @since 10"]
pub buffer: *mut u8,
#[doc = " Image source update data buffer size.\n @since 10"]
pub bufferSize: usize,
#[doc = " Image source offset of update data buffer.\n @since 10"]
pub offset: u32,
#[doc = " Image source update data length in update data buffer.\n @since 10"]
pub updateLength: u32,
#[doc = " Image source update data is completed in this session.\n @since 10"]
pub isCompleted: i8,
}
extern "C" {
#[doc = " @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified\n {@link OhosImageSource} and {@link OhosImageSourceOps} structs.\n\n @param env Indicates a pointer to the Java Native Interface (JNI) environment.\n @param src Indicates a pointer to the input resource of the image source. For details, see {@link OhosImageSource}.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad.\n returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed.\n @see {@link OhosImageSource}, {@link OhosImageSourceOps}\n\n @since 10\n @version 4.0\n @deprecated since 11\n @useinstead image#OH_ImageSource_CreateFromUri\n @useinstead image#OH_ImageSource_CreateFromFd\n @useinstead image#OH_ImageSource_CreateFromData"]
pub fn OH_ImageSource_Create(
env: napi_env,
src: *mut OhosImageSource,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified\n image source URI and {@link OhosImageSourceOps} structs.\n\n @param env Indicates a pointer to the Java Native Interface (JNI) environment.\n @param uri Indicates a pointer to the image source URI. Only a file URI or Base64 URI is accepted.\n @param size Indicates the length of the image source URI.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see {@link OhosImageSourceOps}\n\n @since 11\n @version 4.1"]
pub fn OH_ImageSource_CreateFromUri(
env: napi_env,
uri: *mut ::std::os::raw::c_char,
size: usize,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified\n image source file descriptor and {@link OhosImageSourceOps} structs.\n\n @param env Indicates a pointer to the Java Native Interface (JNI) environment.\n @param fd Indicates the image source file descriptor.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see {@link OhosImageSourceOps}\n\n @since 11\n @version 4.1"]
pub fn OH_ImageSource_CreateFromFd(
env: napi_env,
fd: i32,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified\n image source data and {@link OhosImageSourceOps} structs.\n\n @param env Indicates a pointer to the Java Native Interface (JNI) environment.\n @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.\n @param dataSize Indicates the size of the image source data.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see {@link OhosImageSourceOps}\n\n @since 11\n @version 4.1"]
pub fn OH_ImageSource_CreateFromData(
env: napi_env,
data: *mut u8,
dataSize: usize,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified\n raw file's file descriptor and {@link OhosImageSourceOps} structs.\n\n @param env Indicates a pointer to the Java Native Interface (JNI) environment.\n @param rawFile Indicates the raw file's file descriptor.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see {@link OhosImageSourceOps}\n\n @since 11\n @version 4.1"]
pub fn OH_ImageSource_CreateFromRawFile(
env: napi_env,
rawFile: RawFileDescriptor,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified\n {@link OhosImageSource} and {@link OhosImageSourceOps} structs.\n The image source data will be updated through {@link OH_ImageSource_UpdateData}.\n\n @param env Indicates a pointer to the JNI environment.\n @param src Indicates a pointer to the input resource of the image source. Only the buffer type is accepted.\n For details, see {@link OhosImageSource}.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad.\n returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad.\n returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed.\n @see {@link OhosImageSource}, {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData}\n\n @since 10\n @version 4.0\n @deprecated since 11\n @useinstead image#OH_ImageSource_CreateIncrementalFromData"]
pub fn OH_ImageSource_CreateIncremental(
env: napi_env,
source: *mut OhosImageSource,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified\n image source data and {@link OhosImageSourceOps} structs.\n The image source data will be updated through {@link OH_ImageSource_UpdateData}.\n\n @param env Indicates a pointer to the JNI environment.\n @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted.\n @param dataSize Indicates the size of the image source data.\n @param ops Indicates a pointer to the options for creating the image source.\n For details, see {@link OhosImageSourceOps}.\n @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n @see {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData}\n\n @since 11\n @version 4.1"]
pub fn OH_ImageSource_CreateIncrementalFromData(
env: napi_env,
data: *mut u8,
dataSize: usize,
ops: *mut OhosImageSourceOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains all supported decoding formats.\n\n @param res Indicates a pointer to the <b>OhosImageSourceSupportedFormatList</b> struct.\n When the input <b>supportedFormatList</b> is a null pointer and <b>size</b> is 0, the size of the supported formats\n is returned through <b>size</b> in <b>res</b>.\n To obtain all formats, a space larger than <b>size</b> is required.\n In addition, sufficient space must be reserved for each format supported.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if decode fail.\n @see {@link OhosImageSourceSupportedFormatList}, {@link OhosImageSourceSupportedFormat}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_GetSupportedFormats(res: *mut OhosImageSourceSupportedFormatList) -> i32;
}
extern "C" {
#[doc = " @brief Converts an {@link ImageSource} object at the JavaScript native layer to an <b>ImageSourceNative</b> object\n at the C++ native layer.\n\n @param env Indicates a pointer to the JNI environment.\n @param source Indicates a pointer to the <b>ImageSource</b> object at the JavaScript native layer.\n @return Returns a pointer to the {@link ImageSourceNative} object if the operation is successful;\n returns a null pointer otherwise.\n @see {@link ImageSourceNative}, {@link OH_ImageSource_Release}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_InitNative(env: napi_env, source: napi_value) -> *mut ImageSourceNative;
}
extern "C" {
#[doc = " @brief Decodes an <b>ImageSource</b> object to obtain a <b>PixelMap</b> object at the JavaScript native layer\n based on the specified {@link OhosImageDecodingOps} struct.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param ops Indicates a pointer to the options for decoding the image source.\n For details, see {@link OhosImageDecodingOps}.\n @param res Indicates a pointer to the <b>PixelMap</b> object obtained at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.\n @see {@link ImageSourceNative}, {@link OhosImageDecodingOps}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_CreatePixelMap(
native: *const ImageSourceNative,
ops: *mut OhosImageDecodingOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Decodes an <b>ImageSource</b> to obtain all the <b>PixelMap</b> objects at the JavaScript native layer\n based on the specified {@link OhosImageDecodingOps} struct.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param ops Indicates a pointer to the options for decoding the image source.\n For details, see {@link OhosImageDecodingOps}.\n @param res Indicates a pointer to the <b>PixelMap</b> objects obtained at the JavaScript native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}, {@link OhosImageDecodingOps}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_CreatePixelMapList(
native: *const ImageSourceNative,
ops: *mut OhosImageDecodingOps,
res: *mut napi_value,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the delay time list from some <b>ImageSource</b> objects (such as GIF image sources).\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param res Indicates a pointer to the delay time list obtained.\n For details, see {@link OhosImageSourceDelayTimeList}. When the input <b>delayTimeList</b> is a null pointer and\n <b>size</b> is <b>0</b>, the size of the delay time list is returned through <b>size</b> in <b>res</b>.\n To obtain the complete delay time list, a space greater than <b>size</b> is required.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}, {@link OhosImageSourceDelayTimeList}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_GetDelayTime(
native: *const ImageSourceNative,
res: *mut OhosImageSourceDelayTimeList,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the number of frames from an <b>ImageSource</b> object.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param res Indicates a pointer to the number of frames obtained.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_GetFrameCount(native: *const ImageSourceNative, res: *mut u32) -> i32;
}
extern "C" {
#[doc = " @brief Obtains image source information from an <b>ImageSource</b> object by index.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param index Indicates the index of the frame.\n @param info Indicates a pointer to the image source information obtained.\n For details, see {@link OhosImageSourceInfo}.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}, {@link OhosImageSourceInfo}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_GetImageInfo(
native: *const ImageSourceNative,
index: i32,
info: *mut OhosImageSourceInfo,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the value of an image property from an <b>ImageSource</b> object.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}.\n @param value Indicates a pointer to the property value obtained.\n If the input <b>value</b> is a null pointer and <b>size</b> is <b>0</b>, the size of the property value is returned\n through <b>size</b> in <b>value</b>.\n To obtain the complete property value, a space greater than <b>size</b> is required.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}, {@link OhosImageSourceProperty}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_GetImageProperty(
native: *const ImageSourceNative,
key: *mut OhosImageSourceProperty,
value: *mut OhosImageSourceProperty,
) -> i32;
}
extern "C" {
#[doc = " @brief Modifies the value of an image property of an <b>ImageSource</b> object.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}.\n @param value Indicates a pointer to the new value of the property.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist.\n @see {@link ImageSourceNative}, {@link OhosImageSourceProperty}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_ModifyImageProperty(
native: *const ImageSourceNative,
key: *mut OhosImageSourceProperty,
value: *mut OhosImageSourceProperty,
) -> i32;
}
extern "C" {
#[doc = " @brief Updates the data of an <b>ImageSource</b> object.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @param data Indicates a pointer to the update data. For details, see {@link OhosImageSourceUpdateData}.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - image add pixel map fail.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported.\n returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed.\n returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed.\n @see {@link ImageSourceNative}, {@link OhosImageSourceUpdateData}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_UpdateData(
native: *const ImageSourceNative,
data: *mut OhosImageSourceUpdateData,
) -> i32;
}
extern "C" {
#[doc = " @brief Releases an <b>ImageSourceNative</b> object.\n\n @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer.\n @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful.\n returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment.\n returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter.\n returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error.\n returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error.\n @see {@link ImageSourceNative}, {@link OH_ImageSource_Create}, {@link OH_ImageSource_CreateIncremental}\n\n @since 10\n @version 4.0"]
pub fn OH_ImageSource_Release(native: *mut ImageSourceNative) -> i32;
}