From 158a0637b4e23c8ad6f5bb3613c1dbdbf1fec353 Mon Sep 17 00:00:00 2001 From: tong_kaixing Date: Mon, 14 Oct 2024 12:50:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9Eregion=20isRect=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tong_kaixing --- .../graphic_2d/native_drawing/drawing_region.h | 15 +++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index 39eb09315..b84673138 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -40,6 +40,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -140,6 +141,20 @@ bool OH_Drawing_RegionSetRect(OH_Drawing_Region* region, const OH_Drawing_Rect* */ bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip); +/** + * @brief Determine whether the region is a rect with positive dimensional. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Region Indicates the pointer to an OH_Drawing_Region object. + * @param isRect Indicates if drawable area is empty. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cRegion or isRect is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RegionIsRect(const OH_Drawing_Region* cRegion, bool* isRect); + /** * @brief Destroys an OH_Drawing_Region 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 3f0f7905b..e13ab18ec 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1146,6 +1146,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionSetPath" }, + { + "first_introduced": "14", + "name": "OH_Drawing_RegionIsRect" + }, { "first_introduced": "12", "name": "OH_Drawing_RegionDestroy" -- Gitee From 7ccfa758cde631fb40894b7f73347afda567c6f9 Mon Sep 17 00:00:00 2001 From: yejianlin Date: Tue, 22 Oct 2024 17:29:56 +0800 Subject: [PATCH 2/2] add interface Signed-off-by: yejianlin --- .../native_drawing/drawing_shader_effect.h | 16 ++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h index f3a6245c0..49247968b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h @@ -224,6 +224,22 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateTwoPointConicalGradient(co float startRadius, const OH_Drawing_Point2D* endPt, float endRadius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*); +/** + * @brief Creates an OH_Drawing_ShaderEffect that generates a blend shader by two shaders. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param dstShaderEffect Indicates the destination pointer to an OH_Drawing_ShaderEffect object. + * @param srcShaderEffect Indicates the source pointer to an OH_Drawing_ShaderEffect object. + * @param blendMode Indicates the center of the start circle for the gradient. + * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is any of dstShaderEffect and srcShaderEffect is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateBlendShader(OH_Drawing_ShaderEffect* dstShaderEffect, + OH_Drawing_ShaderEffect* srcShaderEffect, OH_Drawing_BlendMode blendMode); +y /** * @brief Destroys an OH_Drawing_ShaderEffect 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 e13ab18ec..2c97ca657 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -663,6 +663,10 @@ "first_introduced": "12", "name": "OH_Drawing_ShaderEffectCreateTwoPointConicalGradient" }, + { + "first_introduced": "14", + "name": "OH_Drawing_ShaderEffectCreateBlendShader" + }, { "name": "OH_Drawing_ShaderEffectDestroy" }, { "first_introduced": "12", -- Gitee