1 /* 2 * Copyright (c) 2021-2022 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 #ifdef __cplusplus 114 } 115 #endif 116 /** @} */ 117 #endif 118