Skip to main content

OH_ImagePacker_PackToData

Function OH_ImagePacker_PackToData 

Source
pub unsafe extern "C" fn OH_ImagePacker_PackToData(
    native: *mut ImagePacker_Native,
    source: napi_value,
    opts: *mut ImagePacker_Opts,
    outData: *mut u8,
    size: *mut usize,
) -> i32
Expand description

@brief Encoding an ImageSource or a PixelMap into the data with required format

@param native Indicates the pointer to an {@link ImagePacker} object at the native layer. @param source Indicates an encoding source, a JS pixel map object or a JS image source object . @param opts Indicates the encoding {@link ImagePacker_Opts} . @param outData Indicates the pointer to the encoded data. @param size Indicates the pointer to the {@link OhosImageComponent} object obtained. @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. returns {@link IRNdkErrCode} ERR_IMAGE_DATA_ABNORMAL - if output target abnormal returns {@link IRNdkErrCode} ERR_IMAGE_MISMATCHED_FORMAT - if format mismatched returns {@link IRNdkErrCode} ERR_IMAGE_MALLOC_ABNORMAL - if malloc internal buffer error returns {@link IRNdkErrCode} ERR_IMAGE_DECODE_ABNORMAL - if init codec internal error returns {@link IRNdkErrCode} ERR_IMAGE_ENCODE_FAILED - if encoder occur error during encoding @see {@link OH_ImagePacker_PackToFile} @since 11 @version 4.1