!547 feat:add new interfance of shadow layer

Merge pull request !547 from 刘伟/shadowlayer0417
This commit is contained in:
openharmony_ci 2024-04-19 10:07:02 +00:00 committed by Gitee
commit fb58d0d489
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 123 additions and 0 deletions

View File

@ -43,6 +43,7 @@ ohos_ndk_headers("native_drawing_header") {
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_round_rect.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_sampling_options.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_shader_effect.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_surface.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_blob.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_declaration.h",
@ -84,6 +85,7 @@ ohos_ndk_library("libnative_drawing_ndk") {
"native_drawing/drawing_image.h",
"native_drawing/drawing_sampling_options.h",
"native_drawing/drawing_shader_effect.h",
"native_drawing/drawing_shadow_layer.h",
"native_drawing/drawing_surface.h",
"native_drawing/drawing_text_blob.h",
"native_drawing/drawing_text_declaration.h",

View File

@ -143,6 +143,17 @@ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha);
*/
void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*);
/**
* @brief Sets the shadowLayer for a brush.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
* @param OH_Drawing_ShadowLayer Indicates the pointer to an <b>OH_Drawing_ShadowLayer</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_BrushSetShadowLayer(OH_Drawing_Brush*, OH_Drawing_ShadowLayer*);
/**
* @brief Sets the filter for a brush.
*

View File

@ -280,6 +280,17 @@ void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle);
*/
void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*);
/**
* @brief Sets the shadowLayer for a pen.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Pen Indicates the pointer to an <b>OH_Drawing_Pen</b> object.
* @param OH_Drawing_ShadowLayer Indicates the pointer to an <b>OH_Drawing_ShadowLayer</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_PenSetShadowLayer(OH_Drawing_Pen*, OH_Drawing_ShadowLayer*);
/**
* @brief Sets the pathEffect for a pen.
*

View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_SHADOW_LAYER_H
#define C_INCLUDE_DRAWING_SHADOW_LAYER_H
/**
* @addtogroup Drawing
* @{
*
* @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 8
* @version 1.0
*/
/**
* @file drawing_shadow_layer.h
*
* @brief Declares functions related to the <b>ShadowLayer</b> object in the drawing module.
*
* @library libnative_drawing.so
* @since 12
* @version 1.0
*/
#include "drawing_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Creates an <b>OH_Drawing_ShadowLayer</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param blurRadius Indicates the blur radius of the shadow.
* @param x Indicates the offset point on x-axis.
* @param y Indicates the offset point on y-axis.
* @param color Indicates the shadow color.
* @return Returns the pointer to the <b>OH_Drawing_ShadowLayer</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate(float blurRadius, float x, float y, uint32_t color);
/**
* @brief Destroys an <b>OH_Drawing_ShadowLayer</b> object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_ShadowLayer Indicates the pointer to an <b>OH_Drawing_ShadowLayer</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_ShadowLayerDestroy(OH_Drawing_ShadowLayer*);
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@ -188,6 +188,14 @@ typedef struct OH_Drawing_Matrix OH_Drawing_Matrix;
*/
typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect;
/**
* @brief Defines a shadowLayer, which is used to draw shaded parts.
*
* @since 12
* @version 1.0
*/
typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer;
/**
* @brief Defines a filter, which is used to store maskFilter and colorFilter.
*

View File

@ -37,6 +37,10 @@
"name": "OH_Drawing_BrushGetFilter"
},
{ "name": "OH_Drawing_BrushSetShaderEffect" },
{
"first_introduced": "12",
"name": "OH_Drawing_BrushSetShadowLayer"
},
{
"first_introduced": "12",
"name": "OH_Drawing_BrushReset"
@ -302,6 +306,10 @@
"name": "OH_Drawing_PenGetFilter"
},
{ "name": "OH_Drawing_PenSetShaderEffect" },
{
"first_introduced": "12",
"name": "OH_Drawing_PenSetShadowLayer"
},
{
"first_introduced": "12",
"name": "OH_Drawing_PenSetPathEffect"
@ -412,6 +420,14 @@
"name": "OH_Drawing_ShaderEffectCreateImageShader"
},
{ "name": "OH_Drawing_ShaderEffectDestroy" },
{
"first_introduced": "12",
"name": "OH_Drawing_ShadowLayerCreate"
},
{
"first_introduced": "12",
"name": "OH_Drawing_ShadowLayerDestroy"
},
{
"first_introduced": "12",
"name": "OH_Drawing_SurfaceCreateFromGpuContext"