image_packer_native.h

Overview

The file declares the APIs for image encoding.

File to include: <multimedia/image_framework/image/image_packer_native.h>

Library: libimage_packer.so

System capability: SystemCapability.Multimedia.Image.ImagePacker

Since: 12

Related module: Image_NativeModule

Summary

Structs

Name typedef Keyword Description
OH_ImagePackerNative OH_ImagePackerNative Describes the image packer, which is used to perform operations related to an image packer.
OH_PackingOptions OH_PackingOptions OH_PackingOptions is an image encoding option struct encapsulated at the native layer. It cannot be manipulated directly; instead, functions shall be called to create and release the struct, and operate on its specific fields.
OH_PackingOptionsForSequence OH_PackingOptionsForSequence OH_PackingOptionsForSequence is an image sequence encoding option struct encapsulated at the native layer. It cannot be manipulated directly; instead, functions shall be called to create and release the struct, and operate on its specific fields.

Enums

Name typedef Keyword Description
IMAGE_PACKER_DYNAMIC_RANGE IMAGE_PACKER_DYNAMIC_RANGE Enumerates the dynamic range for encoding.

Functions

Name Description
Image_ErrorCode OH_PackingOptions_Create(OH_PackingOptions **options) Creates the pointer to an OH_PackingOptions struct.
Image_ErrorCode OH_PackingOptions_GetMimeType(OH_PackingOptions *options, Image_MimeType *format) Obtains the MIME type. format.data obtained through this API lacks the string terminator \0. Please use it with caution.
Image_ErrorCode OH_PackingOptions_GetMimeTypeWithNull(OH_PackingOptions *options, Image_MimeType *format) Obtains the MIME type in the packing options. The output format.data ends with the string terminator \0.
Image_ErrorCode OH_PackingOptions_SetMimeType(OH_PackingOptions *options, Image_MimeType *format) Sets the MIME type.
Image_ErrorCode OH_PackingOptions_GetQuality(OH_PackingOptions *options, uint32_t *quality) Obtains the encoding quality.
Image_ErrorCode OH_PackingOptions_SetQuality(OH_PackingOptions *options, uint32_t quality) Sets the encoding quality.
Image_ErrorCode OH_PackingOptions_GetNeedsPackProperties(OH_PackingOptions *options, bool *needsPackProperties) Obtains the needsPackProperties parameter in the OH_PackingOptions struct.
Image_ErrorCode OH_PackingOptions_SetNeedsPackProperties(OH_PackingOptions *options, bool needsPackProperties) Sets the needsPackProperties parameter in the OH_PackingOptions struct.
Image_ErrorCode OH_PackingOptions_GetDesiredDynamicRange(OH_PackingOptions options, int32_t desiredDynamicRange) Obtains the desired dynamic range during encoding.
Image_ErrorCode OH_PackingOptions_SetDesiredDynamicRange(OH_PackingOptions *options, int32_t desiredDynamicRange) Sets the desired dynamic range during encoding.
Image_ErrorCode OH_PackingOptions_Release(OH_PackingOptions *options) Releases the pointer to an OH_PackingOptions struct.
Image_ErrorCode OH_PackingOptionsForSequence_Create(OH_PackingOptionsForSequence **options) Creates the pointer to an OH_PackingOptionsForSequence struct.
Image_ErrorCode OH_PackingOptionsForSequence_SetFrameCount(OH_PackingOptionsForSequence *options, uint32_t frameCount) Sets the number of frames for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_GetFrameCount(OH_PackingOptionsForSequence *options, uint32_t *frameCount) Obtains the number of frames for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_SetDelayTimeList(OH_PackingOptionsForSequence *options, int32_t *delayTimeList, size_t delayTimeListLength) Sets the delay time array for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_GetDelayTimeList(OH_PackingOptionsForSequence *options, int32_t *delayTimeList, size_t delayTimeListLength) Obtains the delay time array for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_SetDisposalTypes(OH_PackingOptionsForSequence *options, uint32_t *disposalTypes, size_t disposalTypesLength) Sets the disposal type array for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_GetDisposalTypes(OH_PackingOptionsForSequence *options, uint32_t *disposalTypes, size_t disposalTypesLength) Obtains the disposal type array for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_SetLoopCount(OH_PackingOptionsForSequence *options, uint32_t loopCount) Sets the number of loops for image sequence encoding. The value range is [0, 65535], where 0 means an infinite loop. If this field is not carried, loop playback is not performed.
Image_ErrorCode OH_PackingOptionsForSequence_GetLoopCount(OH_PackingOptionsForSequence *options, uint32_t *loopCount) Obtains the number of loops for image sequence encoding.
Image_ErrorCode OH_PackingOptionsForSequence_Release(OH_PackingOptionsForSequence *options) Releases the pointer to an OH_PackingOptionsForSequence struct.
Image_ErrorCode OH_ImagePackerNative_Create(OH_ImagePackerNative **imagePacker) Creates the pointer to an OH_ImagePackerNative struct.
Image_ErrorCode OH_ImagePackerNative_PackToDataFromImageSource(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_ImageSourceNative *imageSource, uint8_t *outData, size_t *size) Encodes an image source into data in a given format.
Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmap(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PixelmapNative *pixelmap, uint8_t *outData, size_t *size) Encodes a PixelMap into data in a given format.
Image_ErrorCode OH_ImagePackerNative_PackToDataFromPicture(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PictureNative *picture, uint8_t *outData, size_t *size) Encodes a picture into data in a given format.
Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmapSequence(OH_ImagePackerNative *imagePacker, OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence,size_t sequenceLength, uint8_t *outData, size_t *outDataSize) Encodes a PixelMap sequence into data.
Image_ErrorCode OH_ImagePackerNative_PackToFileFromImageSource(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_ImageSourceNative *imageSource, int32_t fd) Encodes an image source into a file.
Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmap(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PixelmapNative *pixelmap, int32_t fd) Encodes a PixelMap into a file.
Image_ErrorCode OH_ImagePackerNative_PackToFileFromPicture(OH_ImagePackerNative *imagePacker, OH_PackingOptions *options, OH_PictureNative *picture, int32_t fd) Encodes a picture into a file.
Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmapSequence(OH_ImagePackerNative *imagePacker, OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence, size_t sequenceLength, int32_t fd) Encodes a PixelMap sequence into a file.
Image_ErrorCode OH_ImagePackerNative_GetSupportedFormats(Image_MimeType **supportedFormats, size_t *length) Obtains the supported image formats that can be encoded.
Image_ErrorCode OH_ImagePackerNative_Release(OH_ImagePackerNative *imagePacker) Releases the pointer to an OH_ImagePackerNative struct.

Enum Description

IMAGE_PACKER_DYNAMIC_RANGE

enum IMAGE_PACKER_DYNAMIC_RANGE

Description

Enumerates the dynamic range for encoding.

Since: 12

Enum Item Description
IMAGE_PACKER_DYNAMIC_RANGE_AUTO = 0 Adaptive processing.
IMAGE_PACKER_DYNAMIC_RANGE_SDR = 1 Standard dynamic range (SDR).

Function Description

OH_PackingOptions_Create()

Image_ErrorCode OH_PackingOptions_Create(OH_PackingOptions **options)

Description

Creates the pointer to an OH_PackingOptions struct.

Since: 12

Parameters

Name Description
OH_PackingOptions **options Double pointer to the OH_PackingOptions struct created.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_GetMimeType()

Image_ErrorCode OH_PackingOptions_GetMimeType(OH_PackingOptions *options,Image_MimeType *format)

Description

Obtains the MIME type. format.data obtained through this API lacks the string terminator \0. Please use it with caution.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
Image_MimeType *format Pointer to the image format. The format does not need to be manually initialized, and the system will allocate memory. However, you must deallocate the memory after use.
format.data obtained through this API lacks the string terminator \0. You need to check whether the actual data length exceeds the length of the allocated buffer.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_GetMimeTypeWithNull()

Image_ErrorCode OH_PackingOptions_GetMimeTypeWithNull(OH_PackingOptions *options,Image_MimeType *format)

Description

Obtains the MIME type in the packing options. The output format.data ends with the string terminator \0.

Since: 19

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
Image_MimeType *format Pointer to the MIME type.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_PACKER_INVALID_PARAMETER: The options or format parameter is a null pointer.

OH_PackingOptions_SetMimeType()

Image_ErrorCode OH_PackingOptions_SetMimeType(OH_PackingOptions *options,Image_MimeType *format)

Description

Sets the MIME type.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
Image_MimeType *format Pointer to the image format.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_GetQuality()

Image_ErrorCode OH_PackingOptions_GetQuality(OH_PackingOptions *options,uint32_t *quality)

Description

Obtains the encoding quality.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
uint32_t *quality Pointer to the encoding quality.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_SetQuality()

Image_ErrorCode OH_PackingOptions_SetQuality(OH_PackingOptions *options,uint32_t quality)

Description

Sets the encoding quality.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
uint32_t quality Encoding quality.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_GetNeedsPackProperties()

 Image_ErrorCode OH_PackingOptions_GetNeedsPackProperties(OH_PackingOptions *options,bool *needsPackProperties)

Description

Obtains the needsPackProperties parameter in the OH_PackingOptions struct.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
bool *needsPackProperties Whether to encode image property information (for example, Exif). The values include true (yes) and false (no).

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_SetNeedsPackProperties()

Image_ErrorCode OH_PackingOptions_SetNeedsPackProperties(OH_PackingOptions *options,bool needsPackProperties)

Description

Sets the needsPackProperties parameter in the OH_PackingOptions struct.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
bool needsPackProperties Whether to encode image property information (for example, Exif). The values include true (yes) and false (no).

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_GetDesiredDynamicRange()

Image_ErrorCode OH_PackingOptions_GetDesiredDynamicRange(OH_PackingOptions *options, int32_t* desiredDynamicRange)

Description

Obtains the desired dynamic range during encoding.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
int32_t* desiredDynamicRange Desired dynamic range. For details about the available options, see IMAGE_PACKER_DYNAMIC_RANGE.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_SetDesiredDynamicRange()

Image_ErrorCode OH_PackingOptions_SetDesiredDynamicRange(OH_PackingOptions *options, int32_t desiredDynamicRange)

Description

Sets the desired dynamic range during encoding.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
int32_t desiredDynamicRange Desired dynamic range. For details about the available options, see IMAGE_PACKER_DYNAMIC_RANGE.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptions_Release()

Image_ErrorCode OH_PackingOptions_Release(OH_PackingOptions *options)

Description

Releases the pointer to an OH_PackingOptions struct.

Since: 12

Parameters

Name Description
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_Create()

Image_ErrorCode OH_PackingOptionsForSequence_Create(OH_PackingOptionsForSequence **options)

Description

Creates the pointer to an OH_PackingOptionsForSequence struct.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence **options Double pointer to OH_PackingOptionsForSequence.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_SetFrameCount()

Image_ErrorCode OH_PackingOptionsForSequence_SetFrameCount(OH_PackingOptionsForSequence *options,uint32_t frameCount)

Description

Sets the number of frames for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t frameCount Number of frames.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_GetFrameCount()

Image_ErrorCode OH_PackingOptionsForSequence_GetFrameCount(OH_PackingOptionsForSequence *options,uint32_t *frameCount)

Description

Obtains the number of frames for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t *frameCount Pointer to the number of frames.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_SetDelayTimeList()

Image_ErrorCode OH_PackingOptionsForSequence_SetDelayTimeList(OH_PackingOptionsForSequence *options,int32_t *delayTimeList, size_t delayTimeListLength)

Description

Sets the delay time array for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
int32_t *delayTimeList Pointer to the delay time array.
size_t delayTimeListLength Length of the delay time array.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_GetDelayTimeList()

Image_ErrorCode OH_PackingOptionsForSequence_GetDelayTimeList(OH_PackingOptionsForSequence *options,int32_t *delayTimeList, size_t delayTimeListLength)

Description

Obtains the delay time array for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
int32_t *delayTimeList Pointer to the delay time array.
size_t delayTimeListLength Length of the delay time array.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_SetDisposalTypes()

Image_ErrorCode OH_PackingOptionsForSequence_SetDisposalTypes(OH_PackingOptionsForSequence *options,uint32_t *disposalTypes, size_t disposalTypesLength)

Description

Sets the disposal type array for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t *disposalTypes Pointer to an array that defines how each image frame transitions. If the array length is less than frameCount, the last value in the array will be used for the remaining frames. The values can be:
0: No operation is required.
1: Keeps the image unchanged.
2: Restores the background color.
3: Restores to the previous state.
size_t disposalTypesLength Length of the disposal type array.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_GetDisposalTypes()

Image_ErrorCode OH_PackingOptionsForSequence_GetDisposalTypes(OH_PackingOptionsForSequence *options,uint32_t *disposalTypes, size_t disposalTypesLength)

Description

Obtains the disposal type array for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t *disposalTypes Pointer to the disposal type array.
size_t disposalTypesLength Length of the disposal type array.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_SetLoopCount()

Image_ErrorCode OH_PackingOptionsForSequence_SetLoopCount(OH_PackingOptionsForSequence *options, uint32_t loopCount)

Description

Sets the number of loops for image sequence encoding. The value range is [0, 65535], where 0 means an infinite loop. If this field is not carried, loop playback is not performed.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t loopCount Number of loops.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_GetLoopCount()

Image_ErrorCode OH_PackingOptionsForSequence_GetLoopCount(OH_PackingOptionsForSequence *options, uint32_t *loopCount)

Description

Obtains the number of loops for image sequence encoding.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.
uint32_t *loopCount Pointer to the number of loops.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_PackingOptionsForSequence_Release()

Image_ErrorCode OH_PackingOptionsForSequence_Release(OH_PackingOptionsForSequence *options)

Description

Releases the pointer to an OH_PackingOptionsForSequence struct.

Since: 18

Parameters

Name Description
OH_PackingOptionsForSequence *options Pointer to OH_PackingOptionsForSequence.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_ImagePackerNative_Create()

Image_ErrorCode OH_ImagePackerNative_Create(OH_ImagePackerNative **imagePacker)

Description

Creates the pointer to an OH_ImagePackerNative struct.

Since: 12

Parameters

Name Description
OH_ImagePackerNative **imagePacker Double pointer to OH_ImagePackerNative.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

OH_ImagePackerNative_PackToDataFromImageSource()

Image_ErrorCode OH_ImagePackerNative_PackToDataFromImageSource(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_ImageSourceNative *imageSource, uint8_t *outData, size_t *size)

Description

Encodes an image source into data in a given format.

Since: 12

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_ImageSourceNative *imageSource Pointer to the image source to encode.
uint8_t *outData Pointer to the buffer used to store the output data.
size_t *size Pointer to the size of the buffer.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.
IMAGE_ALLOC_FAILED: Memory allocation fails.
IMAGE_TOO_LARGE: The data or image is too large.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_ImagePackerNative_PackToDataFromPixelmap()

Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmap(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_PixelmapNative *pixelmap, uint8_t *outData, size_t *size)

Description

Encodes a PixelMap into data in a given format.

Since: 12

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_PixelmapNative *pixelmap Pointer to the PixelMap to encode.
uint8_t *outData Pointer to the buffer used to store the output data.
size_t *size Pointer to the size of the buffer.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.
IMAGE_ALLOC_FAILED: Memory allocation fails.
IMAGE_TOO_LARGE: The data or image is too large.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_ImagePackerNative_PackToDataFromPicture()

Image_ErrorCode OH_ImagePackerNative_PackToDataFromPicture(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_PictureNative *picture, uint8_t *outData, size_t *size)

Description

Encodes a picture into data in a given format.

Since: 13

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_PictureNative *picture Pointer to the picture to encode.
uint8_t *outData Pointer to the buffer used to store the output data.
size_t *size Pointer to the size of the buffer.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.

OH_ImagePackerNative_PackToDataFromPixelmapSequence()

Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmapSequence(OH_ImagePackerNative *imagePacker,OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence,size_t sequenceLength, uint8_t *outData, size_t *outDataSize)

Description

Encodes a PixelMap sequence into data.

Since: 18

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptionsForSequence *options Pointer to an OH_PackingOptionsForSequence struct.
OH_PixelmapNative **pixelmapSequence Double pointer to the PixelMap sequence to encode.
size_t sequenceLength Length of the PixelMap sequence.
uint8_t *outData Pointer to the buffer used to store the output data.
size_t *outDataSize Pointer to the size of the buffer.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.

OH_ImagePackerNative_PackToFileFromImageSource()

Image_ErrorCode OH_ImagePackerNative_PackToFileFromImageSource(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_ImageSourceNative *imageSource, int32_t fd)

Description

Encodes an image source into a file.

Since: 12

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_ImageSourceNative *imageSource Pointer to the image source to encode.
int32_t fd File descriptor, which is writable.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_ImagePackerNative_PackToFileFromPixelmap()

Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmap(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_PixelmapNative *pixelmap, int32_t fd)

Description

Encodes a PixelMap into a file.

Since: 12

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_PixelmapNative *pixelmap Pointer to the PixelMap to encode.
int32_t fd File descriptor, which is writable.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_ImagePackerNative_PackToFileFromPicture()

Image_ErrorCode OH_ImagePackerNative_PackToFileFromPicture(OH_ImagePackerNative *imagePacker,OH_PackingOptions *options, OH_PictureNative *picture, int32_t fd)

Description

Encodes a picture into a file.

Since: 13

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptions *options Pointer to an OH_PackingOptions struct.
OH_PictureNative *picture Pointer to the picture to encode.
int32_t fd File descriptor, which is writable.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.
IMAGE_UNKNOWN_ERROR: An unknown error occurs.

OH_ImagePackerNative_PackToFileFromPixelmapSequence()

Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmapSequence(OH_ImagePackerNative *imagePacker,OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence, size_t sequenceLength, int32_t fd)

Description

Encodes a PixelMap sequence into a file.

Since: 18

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.
OH_PackingOptionsForSequence *options Pointer to an OH_PackingOptionsForSequence struct.
OH_PixelmapNative **pixelmapSequence Double pointer to the PixelMap sequence to encode.
size_t sequenceLength Length of the PixelMap sequence.
int32_t fd File descriptor, which is writable.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.
IMAGE_DECODE_FAILED: Decoding fails.

OH_ImagePackerNative_GetSupportedFormats()

Image_ErrorCode OH_ImagePackerNative_GetSupportedFormats(Image_MimeType **supportedFormats, size_t *length)

Description

Obtains the supported image formats that can be encoded.

Since: 20

Parameters

Name Description
Image_MimeType **supportedFormats Double pointer to the supported image formats.
size_t *length Pointer to the size of the array.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_PACKER_INVALID_PARAMETER: The supportedFormats or length parameter is a null pointer.

OH_ImagePackerNative_Release()

Image_ErrorCode OH_ImagePackerNative_Release(OH_ImagePackerNative *imagePacker)

Description

Releases the pointer to an OH_ImagePackerNative struct.

Since: 12

Parameters

Name Description
OH_ImagePackerNative *imagePacker Pointer to OH_ImagePackerNative.

Returns

Type Description
Image_ErrorCode IMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.