From 20a827e394b9df5b5e3365b944ffbf4e735c73ef Mon Sep 17 00:00:00 2001 From: lw19901203 Date: Wed, 30 Oct 2024 11:38:50 +0800 Subject: [PATCH] fix:add dashpatheffect and sumpatheffct interface! Signed-off-by: lw19901203 --- .../native_drawing/drawing_path_effect.h | 43 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 8 ++++ 2 files changed, 51 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_path_effect.h b/graphic/graphic_2d/native_drawing/drawing_path_effect.h index b3260d576..3ee157ee7 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_path_effect.h @@ -46,6 +46,21 @@ extern "C" { #endif +/** + * @brief Enumerate path effect types. + * + * @since 14 + * @version 1.0 + */ +typedef enum { + /** Indicates that the path effect is a translation effect. */ + PATH_EFFECT_TRANSLATE, + /** Indicates that the path effect is a rotation effect. */ + PATH_EFFECT_ROTATE, + /** Indicates that the path effect is a morph effect. */ + PATH_EFFECT_MORPH, +} OH_Drawing_PathEffectType; + /** * @brief Creates an OH_Drawing_PathEffect object. * @@ -59,6 +74,34 @@ extern "C" { */ OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); +/** + * @brief Creates an OH_Drawing_PathEffect object and sets the path effect to a dash effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param advance Indicates the distance between the dashed segments. + * @param phase Indicates the offset into intervals array. + * @param type Indicates the type of the path effect. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreatePathDashEffect(const OH_Drawing_Path* path, float advance, float phase, + OH_Drawing_PathEffectType type); + +/** + * @brief Creates an OH_Drawing_PathEffect object and sum the path effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param pathEffectOne Indicates the pointer to an OH_Drawing_PathEffect object. + * @param pathEffectTwo Indicates the pointer to an OH_Drawing_PathEffect object. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 14 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateSumPathEffect(OH_Drawing_PathEffect* pathEffectOne, + OH_Drawing_PathEffect* pathEffectTwo); + /** * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 353ce3f53..8b7738184 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -152,6 +152,14 @@ "name": "OH_Drawing_CanvasGetImageInfo" }, { "name": "OH_Drawing_CreateDashPathEffect" }, + { + "first_introduced": "14", + "name": "OH_Drawing_CreatePathDashEffect" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_CreateSumPathEffect" + }, { "name": "OH_Drawing_PathEffectDestroy" }, { "name": "OH_Drawing_ColorFilterCreateBlendMode" }, { "name": "OH_Drawing_ColorFilterCreateCompose" }, -- Gitee