harmony 鸿蒙ImageEffect

2025-06-12 浏览 (1)

ImageEffect

Overview

The ImageEffect module provides the APIs for editing an image.

For details about the development guide and sample, see Using ImageEffect to Edit Images.

Since: 12

Summary

Files

NameDescription
image_effect.hDeclares the APIs related to the image effector.
image_effect_errors.hDeclares the error codes used by the image effector.
image_effect_filter.hDeclare the APIs related to the image effect filter.

Structs

NameDescription
union ImageEffect_DataValueDescribes the data values.
struct ImageEffect_AnyDescribes the image effect parameters.
struct ImageEffect_FilterNamesDescribes the filter name information.
struct ImageEffect_FilterDelegateDescribes the callback functions of a custom image effect filter.
struct ImageEffect_RegionDescribes the image region.
struct ImageEffect_SizeDescribes the image size.

Macros

NameDescription
OH_EFFECT_BRIGHTNESS_FILTER "Brightness"Brightness filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
OH_EFFECT_CONTRAST_FILTER "Contrast"Contrast filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.
OH_EFFECT_CROP_FILTER "Crop"Crop filter. The corresponding parameter is OH_EFFECT_FILTER_REGION_KEY, the parameter type is EFFECT_DATA_TYPE_PTR, and the parameter value is ImageEffect_Region.
OH_EFFECT_FILTER_INTENSITY_KEY "FilterIntensity"Intensity filter.
OH_EFFECT_FILTER_REGION_KEY "FilterRegion"Image region filter.

Types

NameDescription
typedef struct OH_ImageEffect OH_ImageEffectDefines a struct for the image effector.
typedef enum ImageEffect_ErrorCode ImageEffect_ErrorCodeDefines an enum for the error codes used by the image effector.
typedef struct OH_EffectFilter OH_EffectFilterDefines a struct for the image effect filter.
typedef enum ImageEffect_DataType ImageEffect_DataTypeDefines an enum for the data types.
typedef union ImageEffect_DataValue ImageEffect_DataValueDefines a union for the data values.
typedef struct ImageEffect_Any ImageEffect_AnyDefines a struct for the image effect parameters.
typedef enum ImageEffect_Format ImageEffect_FormatDefines an enum for the pixel formats.
typedef enum ImageEffect_BufferType ImageEffect_BufferTypeDefines an enum for the buffer types.
typedef struct OH_EffectFilterInfo OH_EffectFilterInfoDefines a struct for the image effect filter information.
typedef struct ImageEffect_FilterNames ImageEffect_FilterNamesDefines a struct for the filter name information.
typedef struct OH_EffectBufferInfo OH_EffectBufferInfoDefines a struct for the image buffer information.
typedef bool(* OH_EffectFilterDelegate_SetValue) (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.
typedef void(* OH_EffectFilterDelegate_PushData) (OH_EffectFilter *filter, OH_EffectBufferInfo *info)Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter.
typedef bool(* OH_EffectFilterDelegate_Render) (OH_EffectFilter *filter, OH_EffectBufferInfo *info, OH_EffectFilterDelegate_PushData pushData)Defines a pointer to the callback function for rendering an image using a custom filter.
typedef bool(* OH_EffectFilterDelegate_Save) (OH_EffectFilter *filter, char **info)Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.
typedef OH_EffectFilter *(* OH_EffectFilterDelegate_Restore) (const char *info)Defines a pointer to the callback function for deserializing a custom filter.
typedef struct ImageEffect_FilterDelegate ImageEffect_FilterDelegateDefines a struct for the callback functions of a custom image effect filter.
typedef struct ImageEffect_Region ImageEffect_RegionDefines a struct for the image region.
typedef struct ImageEffect_Size ImageEffect_SizeDefines a struct for the image size.

Enums

NameDescription
ImageEffect_ErrorCode {
EFFECT_SUCCESS = 0, EFFECT_ERROR_PERMISSION_DENIED = 201,
EFFECT_ERROR_PARAM_INVALID = 401, EFFECT_BUFFER_SIZE_NOT_MATCH = 29000001,
EFFECT_COLOR_SPACE_NOT_MATCH = 29000002, EFFECT_INPUT_OUTPUT_NOT_MATCH = 29000101,
EFFECT_EFFECT_NUMBER_LIMITED = 29000102, EFFECT_INPUT_OUTPUT_NOT_SUPPORTED = 29000103,
EFFECT_ALLOCATE_MEMORY_FAILED = 29000104, EFFECT_PARAM_ERROR = 29000121,
EFFECT_KEY_ERROR = 29000122, EFFECT_UNKNOWN = 29000199
}
Enumerates the error codes used by the image effector.
ImageEffect_DataType {
EFFECT_DATA_TYPE_UNKNOWN = 0, EFFECT_DATA_TYPE_INT32 = 1,
EFFECT_DATA_TYPE_FLOAT = 2, EFFECT_DATA_TYPE_DOUBLE = 3,
EFFECT_DATA_TYPE_CHAR = 4, EFFECT_DATA_TYPE_LONG = 5,
EFFECT_DATA_TYPE_BOOL = 6, EFFECT_DATA_TYPE_PTR = 7
}
Enumerates the data types.
ImageEffect_Format {
EFFECT_PIXEL_FORMAT_UNKNOWN = 0, EFFECT_PIXEL_FORMAT_RGBA8888 = 1,
EFFECT_PIXEL_FORMAT_NV21 = 2, EFFECT_PIXEL_FORMAT_NV12 = 3,
EFFECT_PIXEL_FORMAT_RGBA1010102 = 4, EFFECT_PIXEL_FORMAT_YCBCR_P010 = 5,
EFFECT_PIXEL_FORMAT_YCRCB_P010 = 6
}
Enumerates the pixel formats.
ImageEffect_BufferType { EFFECT_BUFFER_TYPE_UNKNOWN = 0,
EFFECT_BUFFER_TYPE_PIXEL = 1, EFFECT_BUFFER_TYPE_TEXTURE = 2 }
Enumerates the buffer types.

Functions

NameDescription
OH_ImageEffect * OH_ImageEffect_Create (const char *name)Creates an OH_ImageEffect instance. The instance must be released by calling OH_ImageEffect_Release when it is no longer needed.
OH_EffectFilter * OH_ImageEffect_AddFilter (OH_ImageEffect *imageEffect, const char *filterName)Adds a filter.
ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter (OH_ImageEffect *imageEffect, OH_EffectFilter *filter)Adds a specified filter.
OH_EffectFilter * OH_ImageEffect_InsertFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)Inserts a filter.
ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter (OH_ImageEffect *imageEffect, uint32_t index, OH_EffectFilter *filter)Inserts a filter to the specified position.
int32_t OH_ImageEffect_RemoveFilter (OH_ImageEffect *imageEffect, const char *filterName)Removes a filter.
ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex (OH_ImageEffect *imageEffect, uint32_t index)Removes a filter from the specified position.
OH_EffectFilter * OH_ImageEffect_ReplaceFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)Replaces a filter.
ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter (OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)Replaces a filter at the specified position.
int32_t OH_ImageEffect_GetFilterCount (OH_ImageEffect *imageEffect)Obtains the number of added filters.
OH_EffectFilter * OH_ImageEffect_GetFilter (OH_ImageEffect *imageEffect, uint32_t index)Obtains the information about a filter.
ImageEffect_ErrorCode OH_ImageEffect_Configure (OH_ImageEffect *imageEffect, const char *key, const ImageEffect_Any *value)Configures an image effector.
ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface (OH_ImageEffect *imageEffect, OHNativeWindow *nativeWindow)Sets an output surface.
ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface (OH_ImageEffect *imageEffect, OHNativeWindow **nativeWindow)Obtains an input surface.
ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap (OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)Sets an input PixelMap.
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap (OH_ImageEffect *imageEffect, OH_PixelmapNative *pixelmap)Sets an output PixelMap.
ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer (OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)Sets an input native buffer.
ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer (OH_ImageEffect *imageEffect, OH_NativeBuffer *nativeBuffer)Sets an output native buffer.
ImageEffect_ErrorCode OH_ImageEffect_SetInputUri (OH_ImageEffect *imageEffect, const char *uri)Sets an input URI.
ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri (OH_ImageEffect *imageEffect, const char *uri)Sets an output URI.
ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture (OH_ImageEffect *imageEffect, OH_PictureNative *picture)Sets an input picture.
ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture (OH_ImageEffect *imageEffect, OH_PictureNative *picture)Sets an output picture.
ImageEffect_ErrorCode OH_ImageEffect_Start (OH_ImageEffect *imageEffect)Starts an image effector.
ImageEffect_ErrorCode OH_ImageEffect_Stop (OH_ImageEffect *imageEffect)Stops an image effector.
ImageEffect_ErrorCode OH_ImageEffect_Release (OH_ImageEffect *imageEffect)Releases an OH_ImageEffect instance.
ImageEffect_ErrorCode OH_ImageEffect_Save (OH_ImageEffect *imageEffect, char **info)Serializes an image effector.
OH_ImageEffect * OH_ImageEffect_Restore (const char *info)Deserializes an image effector.
OH_EffectFilterInfo * OH_EffectFilterInfo_Create ()Creates an OH_EffectFilterInfo instance. The instance must be released by calling OH_EffectFilterInfo_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName (OH_EffectFilterInfo *info, const char *name)Sets a filter name.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName (OH_EffectFilterInfo *info, char **name)Obtains a filter name.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes (OH_EffectFilterInfo *info, uint32_t size, ImageEffect_BufferType *bufferTypeArray)Sets the buffer types supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes (OH_EffectFilterInfo *info, uint32_t *size, ImageEffect_BufferType **bufferTypeArray)Obtains the buffer types supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats (OH_EffectFilterInfo *info, uint32_t size, ImageEffect_Format *formatArray)Sets the pixel formats supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats (OH_EffectFilterInfo *info, uint32_t *size, ImageEffect_Format **formatArray)Obtains the pixel formats supported by a filter.
ImageEffect_ErrorCode OH_EffectFilterInfo_Release (OH_EffectFilterInfo *info)Destroys an OH_EffectFilterInfo instance.
OH_EffectBufferInfo * OH_EffectBufferInfo_Create ()Creates an OH_EffectBufferInfo instance. The instance must be released by calling OH_EffectBufferInfo_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr (OH_EffectBufferInfo *info, void *addr)Sets the address of an effect buffer.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr (OH_EffectBufferInfo *info, void **addr)Obtains the address of an effect buffer.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth (OH_EffectBufferInfo *info, int32_t width)Sets the image width.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth (OH_EffectBufferInfo *info, int32_t *width)Obtains the image width.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight (OH_EffectBufferInfo *info, int32_t height)Sets the image height.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight (OH_EffectBufferInfo *info, int32_t *height)Obtains the image height.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize (OH_EffectBufferInfo *info, int32_t rowSize)Sets the number of bytes per row for an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize (OH_EffectBufferInfo *info, int32_t *rowSize)Obtains the number of bytes per row of an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat (OH_EffectBufferInfo *info, ImageEffect_Format format)Sets the pixel format for an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat (OH_EffectBufferInfo *info, ImageEffect_Format *format)Obtains the pixel format of an image.
ImageEffect_ErrorCode OH_EffectBufferInfo_Release (OH_EffectBufferInfo *info)Destroys an OH_EffectBufferInfo instance.
OH_EffectFilter * OH_EffectFilter_Create (const char *name)Creates an OH_EffectFilter instance. The instance must be released by calling OH_EffectFilter_Release when it is no longer needed.
ImageEffect_ErrorCode OH_EffectFilter_SetValue (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)Sets a filter parameter.
ImageEffect_ErrorCode OH_EffectFilter_GetValue (OH_EffectFilter *filter, const char *key, ImageEffect_Any *value)Obtains a filter parameter.
ImageEffect_ErrorCode OH_EffectFilter_Register (const OH_EffectFilterInfo *info, const ImageEffect_FilterDelegate *delegate)Registers a custom filter.
ImageEffect_FilterNames * OH_EffectFilter_LookupFilters (const char *key)Obtains filters that meet given conditions.
void OH_EffectFilter_ReleaseFilterNames ()Releases filter name memory resources.
ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo (const char *name, OH_EffectFilterInfo *info)Obtains the filter information.
ImageEffect_ErrorCode OH_EffectFilter_Render (OH_EffectFilter *filter, OH_PixelmapNative *inputPixelmap, OH_PixelmapNative *outputPixelmap)Starts image rendering.
ImageEffect_ErrorCode OH_EffectFilter_Release (OH_EffectFilter *filter)Destroys an OH_EffectFilter instance.

Macro Description

OH_EFFECT_BRIGHTNESS_FILTER

#define OH_EFFECT_BRIGHTNESS_FILTER   "Brightness"

Description

Brightness filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EFFECT_CONTRAST_FILTER

#define OH_EFFECT_CONTRAST_FILTER   "Contrast"

Description

Contrast filter. The corresponding parameter is OH_EFFECT_FILTER_INTENSITY_KEY and the parameter type is EFFECT_DATA_TYPE_FLOAT.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EFFECT_CROP_FILTER

#define OH_EFFECT_CROP_FILTER   "Crop"

Description

Crop filter. The corresponding parameter is OH_EFFECT_FILTER_REGION_KEY, the parameter type is EFFECT_DATA_TYPE_PTR, and the parameter value is ImageEffect_Region.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EFFECT_FILTER_INTENSITY_KEY

#define OH_EFFECT_FILTER_INTENSITY_KEY   "FilterIntensity"

Description

Intensity filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EFFECT_FILTER_REGION_KEY

#define OH_EFFECT_FILTER_REGION_KEY   "FilterRegion"

Description

Image region filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Type Description

ImageEffect_Any

typedef struct ImageEffect_Any ImageEffect_Any

Description

Defines a struct for the image effect parameters.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_BufferType

typedef enum ImageEffect_BufferType ImageEffect_BufferType

Description

Defines an enum for the buffer types.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_DataType

typedef enum ImageEffect_DataType ImageEffect_DataType

Description

Defines an enum for the data types.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_DataValue

typedef union ImageEffect_DataValue ImageEffect_DataValue

Description

Defines a union for the data values.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_ErrorCode

typedef enum ImageEffect_ErrorCode ImageEffect_ErrorCode

Description

Defines an enum for the error codes used by the image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_FilterDelegate

typedef struct ImageEffect_FilterDelegate ImageEffect_FilterDelegate

Description

Defines a struct for the callback functions of a custom image effect filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_FilterNames

typedef struct ImageEffect_FilterNames ImageEffect_FilterNames

Description

Defines a struct for the filter name information.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_Format

typedef enum ImageEffect_Format ImageEffect_Format

Description

Defines an enum for the pixel formats.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_Region

typedef struct ImageEffect_Region ImageEffect_Region

Description

Defines a struct for the image region.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ImageEffect_Size

typedef struct ImageEffect_Size ImageEffect_Size

Description

Defines a struct for the image size.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EffectBufferInfo

typedef struct OH_EffectBufferInfo OH_EffectBufferInfo

Description

Defines a struct for the image buffer information.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EffectFilter

typedef struct OH_EffectFilter OH_EffectFilter

Description

Defines a struct for the image effect filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EffectFilterDelegate_PushData

typedef void(* OH_EffectFilterDelegate_PushData) (OH_EffectFilter *filter, OH_EffectBufferInfo *info)

Description

Defines a pointer to the callback function used by a custom filter to push image data to the next-level filter. The function pointer must be actively called in the callback of OH_EffectFilterDelegate_Render.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
infoPointer to the buffer information, which is OH_EffectBufferInfo.

OH_EffectFilterDelegate_Render

typedef bool(* OH_EffectFilterDelegate_Render) (OH_EffectFilter *filter, OH_EffectBufferInfo *info, OH_EffectFilterDelegate_PushData pushData)

Description

Defines a pointer to the callback function for rendering an image using a custom filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
infoPointer to the buffer information, which is OH_EffectBufferInfo.
pushDataCallback function OH_EffectFilterDelegate_PushData used by the custom filter to push image data to the next-level filter.

Returns

Returns true if the operation is successful; returns false otherwise.

OH_EffectFilterDelegate_Restore

typedef OH_EffectFilter*(* OH_EffectFilterDelegate_Restore) (const char *info)

Description

Defines a pointer to the callback function for deserializing a custom filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to a serialized JSON string.

Returns

Returns an OH_EffectFilter instance if the operation is successful; returns a null pointer otherwise.

OH_EffectFilterDelegate_Save

typedef bool(* OH_EffectFilterDelegate_Save) (OH_EffectFilter *filter, char **info)

Description

Defines a pointer to the callback function for serializing a custom filter. Filters are serialized in JSON format.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
infoDouble pointer to a char array holding a serialized JSON string.

Returns

Returns true if the operation is successful; returns false otherwise.

OH_EffectFilterDelegate_SetValue

typedef bool(* OH_EffectFilterDelegate_SetValue) (OH_EffectFilter *filter, const char *key, const ImageEffect_Any *value)

Description

Defines a pointer to the callback function for setting parameters of a custom filter. It is used to verify parameters and parameter values.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
keyPointer to the key of a filter parameter.
valuePointer to the value of the filter parameter.

Returns

Returns true if the parameter is valid; returns false otherwise.

OH_EffectFilterInfo

typedef struct OH_EffectFilterInfo OH_EffectFilterInfo

Description

Defines a struct for the image effect filter information.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_ImageEffect

typedef struct OH_ImageEffect OH_ImageEffect

Description

Defines a struct for the image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Enum Description

ImageEffect_BufferType

enum ImageEffect_BufferType

Description

Enumerates the buffer types.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ValueDescription
EFFECT_BUFFER_TYPE_UNKNOWNUndefined type.
EFFECT_BUFFER_TYPE_PIXELPixel image type.
EFFECT_BUFFER_TYPE_TEXTURETexture type.

ImageEffect_DataType

enum ImageEffect_DataType

Description

Enumerates the data types.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ValueDescription
EFFECT_DATA_TYPE_UNKNOWNUndefined type.
EFFECT_DATA_TYPE_INT32Integer.
EFFECT_DATA_TYPE_FLOATSingle-precision floating point.
EFFECT_DATA_TYPE_DOUBLEDouble-precision floating point.
EFFECT_DATA_TYPE_CHARByte.
EFFECT_DATA_TYPE_LONGLong integer.
EFFECT_DATA_TYPE_BOOLBoolean.
EFFECT_DATA_TYPE_PTRPointer.

ImageEffect_ErrorCode

enum ImageEffect_ErrorCode

Description

Enumerates the error codes used by the image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ValueDescription
EFFECT_SUCCESSThe operation is successful.
EFFECT_ERROR_PERMISSION_DENIEDPermission verification fails.
EFFECT_ERROR_PARAM_INVALIDParameter check fails.
EFFECT_BUFFER_SIZE_NOT_MATCHThe output buffer size does not match.
EFFECT_COLOR_SPACE_NOT_MATCHThe input and output color spaces do not match.
EFFECT_INPUT_OUTPUT_NOT_MATCHThe input and output configurations do not match. For example, the input is a surface, but the output is a PixelMap.
EFFECT_EFFECT_NUMBER_LIMITEDThe maximum number is reached.
EFFECT_INPUT_OUTPUT_NOT_SUPPORTEDThe input or output configuration is not supported.
EFFECT_ALLOCATE_MEMORY_FAILEDRequesting for the buffer fails.
EFFECT_PARAM_ERRORInvalid parameter value. For example, the filter parameter value is invalid.
EFFECT_KEY_ERRORInvalid parameter. For example, the filter parameter is invalid.
EFFECT_UNKNOWNUndefined error.

ImageEffect_Format

enum ImageEffect_Format

Description

Enumerates the pixel formats.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

ValueDescription
EFFECT_PIXEL_FORMAT_UNKNOWNUndefined format.
EFFECT_PIXEL_FORMAT_RGBA8888RGBA8888.
EFFECT_PIXEL_FORMAT_NV21NV21.
EFFECT_PIXEL_FORMAT_NV12NV12.
EFFECT_PIXEL_FORMAT_RGBA101010210-bit RGBA.
EFFECT_PIXEL_FORMAT_YCBCR_P01010-bit YCBCR420.
EFFECT_PIXEL_FORMAT_YCRCB_P01010-bit YCRCB420.

Function Description

OH_EffectBufferInfo_Create()

OH_EffectBufferInfo* OH_EffectBufferInfo_Create ()

Description

Creates an OH_EffectBufferInfo instance. The instance must be released by calling OH_EffectBufferInfo_Release when it is no longer needed.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Returns

Returns the pointer to the OH_EffectBufferInfo instance created if the operation is successful; returns a null pointer otherwise.

OH_EffectBufferInfo_GetAddr()

ImageEffect_ErrorCode OH_EffectBufferInfo_GetAddr (OH_EffectBufferInfo * info, void ** addr )

Description

Obtains the address of an effect buffer.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
addrDouble pointer to the virtual address of the image buffer.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_GetEffectFormat()

ImageEffect_ErrorCode OH_EffectBufferInfo_GetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format * format )

Description

Obtains the pixel format of an image.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
formatPointer to the pixel format, which is ImageEffect_Format.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_GetHeight()

ImageEffect_ErrorCode OH_EffectBufferInfo_GetHeight (OH_EffectBufferInfo * info, int32_t * height )

Description

Obtains the image height.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
heightPointer to the image height, in px.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_GetRowSize()

ImageEffect_ErrorCode OH_EffectBufferInfo_GetRowSize (OH_EffectBufferInfo * info, int32_t * rowSize )

Description

Obtains the number of bytes per row of an image.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
rowSizePointer to the number of bytes per row, in bytes.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_GetWidth()

ImageEffect_ErrorCode OH_EffectBufferInfo_GetWidth (OH_EffectBufferInfo * info, int32_t * width )

Description

Obtains the image width.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
widthPointer to the image width, in px.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_Release()

ImageEffect_ErrorCode OH_EffectBufferInfo_Release (OH_EffectBufferInfo * info)

Description

Destroys an OH_EffectBufferInfo instance.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_SetAddr()

ImageEffect_ErrorCode OH_EffectBufferInfo_SetAddr (OH_EffectBufferInfo * info, void * addr )

Description

Sets the address of an effect buffer.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
addrPointer to the virtual address of the image buffer.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_SetEffectFormat()

ImageEffect_ErrorCode OH_EffectBufferInfo_SetEffectFormat (OH_EffectBufferInfo * info, ImageEffect_Format format )

Description

Sets the pixel format for an image.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
formatPixel format, which is ImageEffect_Format.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_SetHeight()

ImageEffect_ErrorCode OH_EffectBufferInfo_SetHeight (OH_EffectBufferInfo * info, int32_t height )

Description

Sets the image height.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
heightImage height, in px.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_SetRowSize()

ImageEffect_ErrorCode OH_EffectBufferInfo_SetRowSize (OH_EffectBufferInfo * info, int32_t rowSize )

Description

Sets the number of bytes per row for an image.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
rowSizeNumber of bytes per row, in bytes.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectBufferInfo_SetWidth()

ImageEffect_ErrorCode OH_EffectBufferInfo_SetWidth (OH_EffectBufferInfo * info, int32_t width )

Description

Sets the image width.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the image information.
widthImage width, in px.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilter_Create()

OH_EffectFilter* OH_EffectFilter_Create (const char * name)

Description

Creates an OH_EffectFilter instance. The instance must be released by calling OH_EffectFilter_Release when it is no longer needed.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
namePointer to the filter name, for example, OH_EFFECT_BRIGHTNESS_FILTER.

Returns

Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer otherwise.

OH_EffectFilter_GetValue()

ImageEffect_ErrorCode OH_EffectFilter_GetValue (OH_EffectFilter * filter, const char * key, ImageEffect_Any * value )

Description

Obtains a filter parameter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
keyPointer to the key of the filter parameter, for example, OH_EFFECT_FILTER_INTENSITY_KEY.
valuePointer to the value of the filter parameter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid.

OH_EffectFilter_LookupFilterInfo()

ImageEffect_ErrorCode OH_EffectFilter_LookupFilterInfo (const char * name, OH_EffectFilterInfo * info )

Description

Obtains the filter information.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
namePointer to the filter name.
infoPointer to the filter information, which is OH_EffectFilterInfo.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer or an invalid value.

OH_EffectFilter_LookupFilters()

ImageEffect_FilterNames* OH_EffectFilter_LookupFilters (const char * key)

Description

Obtains filters that meet given conditions.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
keyPointer to the conditions. You can use the keyword Default to obtain all filters.

Returns

Returns a list of filter names, which is ImageEffect_FilterNames.

OH_EffectFilter_Register()

ImageEffect_ErrorCode OH_EffectFilter_Register (const OH_EffectFilterInfo * info, const ImageEffect_FilterDelegate * delegate )

Description

Registers a custom filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information, which is OH_EffectFilterInfo.
delegatePointer to the callback function ImageEffect_FilterDelegate of the filter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilter_Release()

ImageEffect_ErrorCode OH_EffectFilter_Release (OH_EffectFilter * filter)

Description

Destroys an OH_EffectFilter instance.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilter_ReleaseFilterNames()

void OH_EffectFilter_ReleaseFilterNames ()

Description

Releases filter name memory resources.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

OH_EffectFilter_Render()

ImageEffect_ErrorCode OH_EffectFilter_Render (OH_EffectFilter * filter, OH_PixelmapNative * inputPixelmap, OH_PixelmapNative * outputPixelmap )

Description

Starts image rendering.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
inputPixelmapPointer to the input image.
outputPixelmapPointer to the output image.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilter_SetValue()

ImageEffect_ErrorCode OH_EffectFilter_SetValue (OH_EffectFilter * filter, const char * key, const ImageEffect_Any * value )

Description

Sets a filter parameter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
filterPointer to the filter.
keyPointer to the key of the filter parameter, for example, OH_EFFECT_FILTER_INTENSITY_KEY.
valuePointer to the value of the filter parameter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid; returns EFFECT_PARAM_ERROR if the value of a parameter is invalid.

OH_EffectFilterInfo_Create()

OH_EffectFilterInfo* OH_EffectFilterInfo_Create ()

Description

Creates an OH_EffectFilterInfo instance. The instance must be released by calling OH_EffectFilterInfo_Release when it is no longer needed.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Returns

Returns the pointer to the OH_EffectFilterInfo instance created if the operation is successful; returns a null pointer otherwise.

OH_EffectFilterInfo_GetFilterName()

ImageEffect_ErrorCode OH_EffectFilterInfo_GetFilterName (OH_EffectFilterInfo * info, char ** name )

Description

Obtains a filter name.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
nameDouble pointer to the char array holding the filter name.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_GetSupportedBufferTypes()

ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_BufferType ** bufferTypeArray )

Description

Obtains the buffer types supported by a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
sizePointer to the number of buffer types supported, each of which is ImageEffect_BufferType.
bufferTypeArrayDouble pointer to the array holding the buffer types supported, each of which is ImageEffect_BufferType.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_GetSupportedFormats()

ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats (OH_EffectFilterInfo * info, uint32_t * size, ImageEffect_Format ** formatArray )

Description

Obtains the pixel formats supported by a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
sizePointer to the number of pixel formats supported, each of which is ImageEffect_Format.
formatArrayDouble pointer to the array holding the pixel formats supported, each of which is ImageEffect_Format.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_Release()

ImageEffect_ErrorCode OH_EffectFilterInfo_Release (OH_EffectFilterInfo * info)

Description

Destroys an OH_EffectFilterInfo instance.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_SetFilterName()

ImageEffect_ErrorCode OH_EffectFilterInfo_SetFilterName (OH_EffectFilterInfo * info, const char * name )

Description

Sets a filter name.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
namePointer to the filter name, for example, OH_EFFECT_BRIGHTNESS_FILTER.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_SetSupportedBufferTypes()

ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedBufferTypes (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_BufferType * bufferTypeArray )

Description

Sets the buffer types supported by a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
sizeNumber of buffer types supported, each of which is ImageEffect_BufferType.
bufferTypeArrayPointer to the array holding the buffer types supported, each of which is ImageEffect_BufferType.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_EffectFilterInfo_SetSupportedFormats()

ImageEffect_ErrorCode OH_EffectFilterInfo_SetSupportedFormats (OH_EffectFilterInfo * info, uint32_t size, ImageEffect_Format * formatArray )

Description

Sets the pixel formats supported by a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to the filter information.
sizeNumber of pixel formats supported, each of which is ImageEffect_Format.
formatArrayPointer to the array holding the pixel formats supported, each of which is ImageEffect_Format.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_AddFilter()

OH_EffectFilter* OH_ImageEffect_AddFilter (OH_ImageEffect * imageEffect, const char * filterName )

Description

Adds a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
filterNamePointer to the filter name.

Returns

Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if the effector is invalid.

OH_ImageEffect_AddFilterByFilter()

ImageEffect_ErrorCode OH_ImageEffect_AddFilterByFilter(OH_ImageEffect *imageEffect, OH_EffectFilter *filter)

Description

Adds a specified filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
filterPointer to the filter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_Configure()

ImageEffect_ErrorCode OH_ImageEffect_Configure (OH_ImageEffect * imageEffect, const char * key, const ImageEffect_Any * value )

Description

Configures an image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
keyPointer to the key of a configuration parameter.
valuePointer to the value of a configuration parameter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_KEY_ERROR if the key of a parameter is invalid; returns EFFECT_PARAM_ERROR if the value of a parameter is invalid.

OH_ImageEffect_Create()

OH_ImageEffect* OH_ImageEffect_Create (const char * name)

Description

Creates an OH_ImageEffect instance. The instance must be released by calling OH_ImageEffect_Release when it is no longer needed.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
namePointer to the image effector name, which is used to identify the effector and can be customized. You are advised to set it to a non-empty string.

Returns

Returns the pointer to the OH_ImageEffect instance created if the operation is successful; returns a null pointer otherwise.

OH_ImageEffect_GetFilter()

OH_EffectFilter* OH_ImageEffect_GetFilter (OH_ImageEffect * imageEffect, uint32_t index )

Description

Obtains the information about a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
indexIndex of the filter.

Returns

Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if an input parameter is invalid.

OH_ImageEffect_GetFilterCount()

int32_t OH_ImageEffect_GetFilterCount (OH_ImageEffect * imageEffect)

Description

Obtains the number of added filters.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.

Returns

Returns the number of filters.

OH_ImageEffect_GetInputSurface()

ImageEffect_ErrorCode OH_ImageEffect_GetInputSurface (OH_ImageEffect * imageEffect, OHNativeWindow ** nativeWindow )

Description

Obtains an input surface.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
nativeWindowDouble pointer to the OHNativeWindow instance.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_InsertFilter()

OH_EffectFilter* OH_ImageEffect_InsertFilter (OH_ImageEffect * imageEffect, uint32_t index, const char * filterName )

Description

Inserts a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
indexIndex of the filter.
filterNamePointer to the filter name.

Returns

Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer if an input parameter is invalid.

OH_ImageEffect_InsertFilterByFilter()

ImageEffect_ErrorCode OH_ImageEffect_InsertFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, OH_EffectFilter *filter);

Description

Inserts a filter to the specified position.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
indexIndex of the filter.
filterPointer to the filter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_Release()

ImageEffect_ErrorCode OH_ImageEffect_Release (OH_ImageEffect * imageEffect)

Description

Releases an OH_ImageEffect instance.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_RemoveFilter()

int32_t OH_ImageEffect_RemoveFilter (OH_ImageEffect * imageEffect, const char * filterName )

Description

Removes a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
filterNamePointer to the filter name.

Returns

Returns the number of filters.

OH_ImageEffect_RemoveFilterByIndex()

ImageEffect_ErrorCode OH_ImageEffect_RemoveFilterByIndex(OH_ImageEffect *imageEffect, uint32_t index)

Description

Removes a filter from the specified position.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
indexIndex of the filter.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_ReplaceFilter()

OH_EffectFilter *OH_ImageEffect_ReplaceFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName)

Description

Replaces a filter.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
filterNamePointer to the filter name.

Returns

Returns the pointer to the OH_EffectFilter instance created if the operation is successful; returns a null pointer otherwise.

OH_ImageEffect_ReplaceFilterByFilter()

ImageEffect_ErrorCode OH_ImageEffect_ReplaceFilterByFilter(OH_ImageEffect *imageEffect, uint32_t index, const char *filterName);

Description

Replaces a filter at the specified position.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
indexIndex of the filter.
filterNamePointer to the filter name.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_Restore()

OH_ImageEffect* OH_ImageEffect_Restore (const char * info)

Description

Deserializes an image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
infoPointer to a serialized JSON string.

Returns

Returns an OH_ImageEffect instance if the deserialization is successful; returns a null pointer otherwise.

OH_ImageEffect_Save()

ImageEffect_ErrorCode OH_ImageEffect_Save (OH_ImageEffect * imageEffect, char ** info )

Description

Serializes an image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
infoDouble pointer to a char array holding a serialized JSON string.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetInputNativeBuffer()

ImageEffect_ErrorCode OH_ImageEffect_SetInputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer )

Description

Sets an input native buffer.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
nativeBufferPointer to the OH_NativeBuffer instance.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetInputPicture()

ImageEffect_ErrorCode OH_ImageEffect_SetInputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)

Description

Sets an input picture.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 13

Parameters

NameDescription
imageEffectPointer to the image effector.
picturePointer to an OH_PictureNative instance.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetInputPixelmap()

ImageEffect_ErrorCode OH_ImageEffect_SetInputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap )

Description

Sets an input PixelMap.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
pixelmapPointer to the OH_PixelmapNative instance.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetInputUri()

ImageEffect_ErrorCode OH_ImageEffect_SetInputUri (OH_ImageEffect * imageEffect, const char * uri )

Description

Sets an input URI.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
uriPointer to the URI of the image. Only JPEG and HEIF images are supported.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetOutputNativeBuffer()

ImageEffect_ErrorCode OH_ImageEffect_SetOutputNativeBuffer (OH_ImageEffect * imageEffect, OH_NativeBuffer * nativeBuffer )

Description

Sets an output native buffer.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
nativeBufferPointer to an OH_NativeBuffer instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_NativeBuffer object.

Returns

Returns EFFECT_SUCCESS if the operation is successful.

Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.

Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.

OH_ImageEffect_SetOutputPicture()

ImageEffect_ErrorCode OH_ImageEffect_SetOutputPicture(OH_ImageEffect *imageEffect, OH_PictureNative *picture)

Description

Sets an output picture.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 13

Parameters

NameDescription
imageEffectPointer to the image effector.
picturePointer to an OH_PictureNative instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_PictureNative object.

Returns

Returns EFFECT_SUCCESS if the operation is successful.

Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.

Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.

OH_ImageEffect_SetOutputPixelmap()

ImageEffect_ErrorCode OH_ImageEffect_SetOutputPixelmap (OH_ImageEffect * imageEffect, OH_PixelmapNative * pixelmap )

Description

Sets an output PixelMap.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
pixelmapPointer to an OH_PixelmapNative instance. The value can be NULL. If NULL is passed, the rendering result is returned to the input OH_PixelmapNative object.

Returns

Returns EFFECT_SUCCESS if the operation is successful.

Returns EFFECT_ERROR_PARAM_INVALID if the input parameter of the effector is a null pointer.

Returns EFFECT_PARAM_ERROR if the call fails because of abnormal parameters.

OH_ImageEffect_SetOutputSurface()

ImageEffect_ErrorCode OH_ImageEffect_SetOutputSurface (OH_ImageEffect * imageEffect, OHNativeWindow * nativeWindow )

Description

Sets an output surface.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
nativeWindowPointer to the OHNativeWindow instance.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_SetOutputUri()

ImageEffect_ErrorCode OH_ImageEffect_SetOutputUri (OH_ImageEffect * imageEffect, const char * uri )

Description

Sets an output URI.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.
uriPointer to the URI of the image. The format of the output URI is the same as that of the input URI. If HEIF encoding is not supported, JPEG encoding is used.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

OH_ImageEffect_Start()

ImageEffect_ErrorCode OH_ImageEffect_Start (OH_ImageEffect * imageEffect)

Description

Starts an image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer; returns EFFECT_INPUT_OUTPUT_NOT_SUPPORTED if the data types of the input and output images to be processed are different; returns EFFECT_COLOR_SPACE_NOT_MATCH if the color spaces of the input and output images are different; returns EFFECT_ALLOCATE_MEMORY_FAILED if the buffer fails to be allocated.

OH_ImageEffect_Stop()

ImageEffect_ErrorCode OH_ImageEffect_Stop (OH_ImageEffect * imageEffect)

Description

Stops an image effector.

System capability: SystemCapability.Multimedia.ImageEffect.Core

Since: 12

Parameters

NameDescription
imageEffectPointer to the image effector.

Returns

Returns EFFECT_SUCCESS if the operation is successful; returns EFFECT_ERROR_PARAM_INVALID if the input parameter is a null pointer.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Image Kit

harmony 鸿蒙_image___native_module

harmony 鸿蒙Image_Region

harmony 鸿蒙Image_Size

harmony 鸿蒙Image_String

harmony 鸿蒙ImageEffect_Any

harmony 鸿蒙ImageEffect_FilterDelegate

harmony 鸿蒙ImageEffect_FilterNames

harmony 鸿蒙ImageEffect_Region

harmony 鸿蒙ImageEffect_Size

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