• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef C_INCLUDE_DRAWING_BRUSH_H
17 #define C_INCLUDE_DRAWING_BRUSH_H
18 
19 /**
20  * @addtogroup Drawing
21  * @{
22  *
23  * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
24  *
25  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
26  *
27  * @since 8
28  * @version 1.0
29  */
30 
31 /**
32  * @file drawing_brush.h
33  *
34  * @brief Declares functions related to the <b>brush</b> object in the drawing module.
35  *
36  * @since 8
37  * @version 1.0
38  */
39 
40 #include "drawing_types.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @brief Creates an <b>OH_Drawing_Brush</b> object.
48  *
49  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
50  * @return Returns the pointer to the <b>OH_Drawing_Brush</b> object created.
51  * @since 8
52  * @version 1.0
53  */
54 OH_Drawing_Brush* OH_Drawing_BrushCreate(void);
55 
56 /**
57  * @brief Destroys an <b>OH_Drawing_Brush</b> object and reclaims the memory occupied by the object.
58  *
59  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
60  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
61  * @since 8
62  * @version 1.0
63  */
64 void OH_Drawing_BrushDestroy(OH_Drawing_Brush*);
65 
66 /**
67  * @brief Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled,
68  * edges will be drawn with partial transparency.
69  *
70  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
71  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
72  * @return Returns <b>true</b> if anti-aliasing is enabled; returns <b>false</b> otherwise.
73  * @since 8
74  * @version 1.0
75  */
76 bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*);
77 
78 /**
79  * @brief Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled,
80  * edges will be drawn with partial transparency.
81  *
82  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
83  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
84  * @param bool Specifies whether to enable anti-aliasing. The value <b>true</b> means
85  *             to enable anti-aliasing, and <b>false</b> means the opposite.
86  * @since 8
87  * @version 1.0
88  */
89 void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool);
90 
91 /**
92  * @brief Obtains the color of a brush. The color is used by the brush to fill in a shape.
93  *
94  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
95  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
96  * @return Returns a 32-bit (ARGB) variable that describes the color.
97  * @since 8
98  * @version 1.0
99  */
100 uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*);
101 
102 /**
103  * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape.
104  *
105  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
106  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
107  * @param color Indicates the color to set, which is a 32-bit (ARGB) variable.
108  * @since 8
109  * @version 1.0
110  */
111 void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color);
112 
113 /**
114  * @brief Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape.
115  *
116  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
117  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
118  * @return Returns a 8-bit variable that describes the alpha.
119  * @since 11
120  * @version 1.0
121  */
122 uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*);
123 
124 /**
125  * @brief Sets the alpha for a brush. The alpha will be used by the brush to fill in a shape.
126  *
127  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
128  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
129  * @param alpha Indicates the alpha to set, which is a 8-bit variable.
130  * @since 11
131  * @version 1.0
132  */
133 void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha);
134 
135 /**
136  * @brief Sets the shaderEffect for a brush.
137  *
138  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
139  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
140  * @param OH_Drawing_ShaderEffect Indicates the pointer to an <b>OH_Drawing_ShaderEffect</b> object.
141  * @since 11
142  * @version 1.0
143  */
144 void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*);
145 
146 /**
147  * @brief Sets the filter for a brush.
148  *
149  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
150  * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
151  * @param OH_Drawing_Filter Indicates the pointer to an <b>OH_Drawing_Filter</b> object.
152  * @since 11
153  * @version 1.0
154  */
155 void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*);
156 
157 /**
158  * @brief Sets a blender that implements the specified blendmode enum for a brush.
159  *
160  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
161  * @param OH_Drawing_Pen Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
162  * @param OH_Drawing_BlendMode Indicates the blend mode.
163  * @since 12
164  * @version 1.0
165  */
166 void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 /** @} */
172 #endif
173