drawing_image_filter.h
Overview
This file declares the functions related to the image filter in the drawing module.
File to include: <native_drawing/drawing_image_filter.h>
Library: libnative_drawing.so
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 12
Related module: Drawing
Summary
Functions
Function Description
OH_Drawing_ImageFilterCreateBlur()
OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode tileMode,OH_Drawing_ImageFilter* imageFilter)
Description
Creates an image filter with a given blur effect.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 12
Parameters
| Name | Description |
|---|---|
| float sigmaX | Standard deviation of the Gaussian blur to apply along the X axis. The value must be greater than 0. |
| float sigmaY | Standard deviation of the Gaussian blur to apply along the Y axis. The value must be greater than 0. |
| OH_Drawing_TileMode tileMode | Tile mode of the shader effect. For details about the available options, see OH_Drawing_TileMode. |
| OH_Drawing_ImageFilter* imageFilter | Pointer to the filter to which the image filter will be applied. If NULL is passed in, the image filter is directly applied to the original image. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_ImageFilter* | Returns the pointer to the OH_Drawing_ImageFilter object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available. |
OH_Drawing_ImageFilterCreateBlurWithCrop()
OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlurWithCrop(float sigmaX, float sigmaY, OH_Drawing_TileMode tileMode, OH_Drawing_ImageFilter* input, const OH_Drawing_Rect* rect)
Description
Creates an image filter with a given blur effect.
You can pass a cropping rectangle to limit the blur effect to take effect only in the specified rectangular area of the image.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 20
Parameters
| Name | Description |
|---|---|
| float sigmaX | Standard deviation of the Gaussian blur to apply along the X axis. The value must be greater than 0.0. |
| float sigmaY | Standard deviation of the Gaussian blur to apply along the Y axis. The value must be greater than 0.0. |
| OH_Drawing_TileMode tileMode | Tile mode of the shader effect. For details about the available options, see OH_Drawing_TileMode. |
| OH_Drawing_ImageFilter* input | Pointer to the filter to which the image filter will be applied. If NULL is passed in, the image filter is directly applied to the original image. |
| const OH_Drawing_Rect* rect | Pointer to the rectangular region to be cropped. If NULL is passed in, the blur effect is directly applied to the entire image. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_ImageFilter* | Returns the pointer to the OH_Drawing_ImageFilter object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available. |
OH_Drawing_ImageFilterCreateFromColorFilter()
OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter* colorFilter,OH_Drawing_ImageFilter* imageFilter)
Description
Creates an OH_Drawing_ImageFilter object with a color filter effect. This API may return an error code. For details, call OH_Drawing_ErrorCodeGet. If colorFilter is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Drawing_ColorFilter* colorFilter | Pointer to an OH_Drawing_ColorFilter object. |
| OH_Drawing_ImageFilter* imageFilter | Pointer to the filter to which the image filter will be applied. If NULL is passed in, the image filter is directly applied to the original image. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_ImageFilter* | Returns the pointer to the OH_Drawing_ImageFilter object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or colorFilter is NULL. |
OH_Drawing_ImageFilterCreateOffset()
OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateOffset(float x, float y, OH_Drawing_ImageFilter* imageFilter)
Description
Creates an offset filter to translate the input filter based on the specified vector.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 20
Parameters
| Name | Description |
|---|---|
| float x | Distance to translate on the X axis. |
| float y | Distance to translate on the Y axis. |
| OH_Drawing_ImageFilter* imageFilter | Filter to be translated. If NULL is passed in, the drawing result without the filtering effect is translated. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_ImageFilter* | Returns the pointer to the OH_Drawing_ImageFilter object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available. |
OH_Drawing_ImageFilterCreateFromShaderEffect()
OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromShaderEffect(OH_Drawing_ShaderEffect* shaderEffect)
Description
Creates an ImageFilter object based on a shader.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 20
Parameters
| Name | Description |
|---|---|
| OH_Drawing_ShaderEffect* shaderEffect | Shader effect to be applied to the image. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_ImageFilter* | Returns the pointer to the OH_Drawing_ImageFilter object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available. |
OH_Drawing_ImageFilterDestroy()
void OH_Drawing_ImageFilterDestroy(OH_Drawing_ImageFilter* imageFilter)
Description
Destroys an OH_Drawing_ImageFilter object and reclaims the memory occupied by the object.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Drawing_ImageFilter* imageFilter | Pointer to an OH_Drawing_ImageFilter object. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 capi-drawing-gpu-context-h
openharmony 鸿蒙 capi-drawing-nativepixelmap-
openharmony 鸿蒙 capi-nativevsync-oh-nativevsync-expectedraterange
openharmony 鸿蒙 capi-drawing-oh-drawing-brush
openharmony 鸿蒙 capi-drawing-oh-drawing-image-info
openharmony 鸿蒙 capi-drawing-text-linetypography-h
openharmony 鸿蒙 capi-oh-nativeimage-oh-nativeimage
openharmony 鸿蒙 capi-drawing-typeface-h