openharmony 鸿蒙 capi-image-packer-native-h

2026-08-25 浏览 (1)

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

Nametypedef KeywordDescription
OH_ImagePackerNativeOH_ImagePackerNativeDescribes the image packer, which is used to perform operations related to an image packer.
OH_PackingOptionsOH_PackingOptionsOH_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_PackingOptionsForSequenceOH_PackingOptionsForSequenceOH_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

Nametypedef KeywordDescription
IMAGE_PACKER_DYNAMIC_RANGEIMAGE_PACKER_DYNAMIC_RANGEEnumerates the dynamic range for encoding.

Functions

NameDescription
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 ItemDescription
IMAGE_PACKER_DYNAMIC_RANGE_AUTO = 0Adaptive processing.
IMAGE_PACKER_DYNAMIC_RANGE_SDR = 1Standard 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

NameDescription
OH_PackingOptions **optionsDouble pointer to the OH_PackingOptions struct created.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
Image_MimeType *formatPointer 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

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
Image_MimeType *formatPointer to the MIME type.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
Image_MimeType *formatPointer to the image format.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
uint32_t *qualityPointer to the encoding quality.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
uint32_t qualityEncoding quality.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
bool *needsPackPropertiesWhether to encode image property information (for example, Exif). The values include true (yes) and false (no).

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
bool needsPackPropertiesWhether to encode image property information (for example, Exif). The values include true (yes) and false (no).

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
int32_t* desiredDynamicRangeDesired dynamic range. For details about the available options, see IMAGE_PACKER_DYNAMIC_RANGE.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
int32_t desiredDynamicRangeDesired dynamic range. For details about the available options, see IMAGE_PACKER_DYNAMIC_RANGE.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence **optionsDouble pointer to OH_PackingOptionsForSequence.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t frameCountNumber of frames.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t *frameCountPointer to the number of frames.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
int32_t *delayTimeListPointer to the delay time array.
size_t delayTimeListLengthLength of the delay time array.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
int32_t *delayTimeListPointer to the delay time array.
size_t delayTimeListLengthLength of the delay time array.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t *disposalTypesPointer 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 disposalTypesLengthLength of the disposal type array.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t *disposalTypesPointer to the disposal type array.
size_t disposalTypesLengthLength of the disposal type array.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t loopCountNumber of loops.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.
uint32_t *loopCountPointer to the number of loops.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_PackingOptionsForSequence *optionsPointer to OH_PackingOptionsForSequence.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative **imagePackerDouble pointer to OH_ImagePackerNative.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_ImageSourceNative *imageSourcePointer to the image source to encode.
uint8_t *outDataPointer to the buffer used to store the output data.
size_t *sizePointer to the size of the buffer.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_PixelmapNative *pixelmapPointer to the PixelMap to encode.
uint8_t *outDataPointer to the buffer used to store the output data.
size_t *sizePointer to the size of the buffer.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_PictureNative *picturePointer to the picture to encode.
uint8_t *outDataPointer to the buffer used to store the output data.
size_t *sizePointer to the size of the buffer.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptionsForSequence *optionsPointer to an OH_PackingOptionsForSequence struct.
OH_PixelmapNative **pixelmapSequenceDouble pointer to the PixelMap sequence to encode.
size_t sequenceLengthLength of the PixelMap sequence.
uint8_t *outDataPointer to the buffer used to store the output data.
size_t *outDataSizePointer to the size of the buffer.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_ImageSourceNative *imageSourcePointer to the image source to encode.
int32_t fdFile descriptor, which is writable.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_PixelmapNative *pixelmapPointer to the PixelMap to encode.
int32_t fdFile descriptor, which is writable.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptions *optionsPointer to an OH_PackingOptions struct.
OH_PictureNative *picturePointer to the picture to encode.
int32_t fdFile descriptor, which is writable.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.
OH_PackingOptionsForSequence *optionsPointer to an OH_PackingOptionsForSequence struct.
OH_PixelmapNative **pixelmapSequenceDouble pointer to the PixelMap sequence to encode.
size_t sequenceLengthLength of the PixelMap sequence.
int32_t fdFile descriptor, which is writable.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
Image_MimeType **supportedFormatsDouble pointer to the supported image formats.
size_t *lengthPointer to the size of the array.

Returns

TypeDescription
Image_ErrorCodeIMAGE_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

NameDescription
OH_ImagePackerNative *imagePackerPointer to OH_ImagePackerNative.

Returns

TypeDescription
Image_ErrorCodeIMAGE_SUCCESS: The operation is successful.
IMAGE_BAD_PARAMETER: A parameter is incorrect.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-image-nativemodule-oh-pixelmap-hdrmetadatavalue

openharmony 鸿蒙 capi-image-imagepacker-opts-

openharmony 鸿蒙 capi-image-nativemodule-image-region

openharmony 鸿蒙 capi-image-imagepacker-native-

openharmony 鸿蒙 capi-image-imagenative-

openharmony 鸿蒙 capi-image-processing-h

openharmony 鸿蒙 capi-image-ohosimagesourcesupportedformat

openharmony 鸿蒙 capi-image-nativemodule-image-size

openharmony 鸿蒙 capi-image-mdk-h

openharmony 鸿蒙 capi-image-ohosimagesourcedelaytimelist

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/pMF86T6r