17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci#ifndef C_INCLUDE_DRAWING_BRUSH_H
177777dab0Sopenharmony_ci#define C_INCLUDE_DRAWING_BRUSH_H
187777dab0Sopenharmony_ci
197777dab0Sopenharmony_ci/**
207777dab0Sopenharmony_ci * @addtogroup Drawing
217777dab0Sopenharmony_ci * @{
227777dab0Sopenharmony_ci *
237777dab0Sopenharmony_ci * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
247777dab0Sopenharmony_ci *
257777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
267777dab0Sopenharmony_ci *
277777dab0Sopenharmony_ci * @since 8
287777dab0Sopenharmony_ci * @version 1.0
297777dab0Sopenharmony_ci */
307777dab0Sopenharmony_ci
317777dab0Sopenharmony_ci/**
327777dab0Sopenharmony_ci * @file drawing_brush.h
337777dab0Sopenharmony_ci *
347777dab0Sopenharmony_ci * @brief Declares functions related to the <b>brush</b> object in the drawing module.
357777dab0Sopenharmony_ci *
367777dab0Sopenharmony_ci * @kit ArkGraphics2D
377777dab0Sopenharmony_ci * @library libnative_drawing.so
387777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
397777dab0Sopenharmony_ci * @since 8
407777dab0Sopenharmony_ci * @version 1.0
417777dab0Sopenharmony_ci */
427777dab0Sopenharmony_ci
437777dab0Sopenharmony_ci#include "drawing_types.h"
447777dab0Sopenharmony_ci
457777dab0Sopenharmony_ci#ifdef __cplusplus
467777dab0Sopenharmony_ciextern "C" {
477777dab0Sopenharmony_ci#endif
487777dab0Sopenharmony_ci
497777dab0Sopenharmony_ci/**
507777dab0Sopenharmony_ci * @brief Creates an <b>OH_Drawing_Brush</b> object.
517777dab0Sopenharmony_ci *
527777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
537777dab0Sopenharmony_ci * @return Returns the pointer to the <b>OH_Drawing_Brush</b> object created.
547777dab0Sopenharmony_ci * @since 8
557777dab0Sopenharmony_ci * @version 1.0
567777dab0Sopenharmony_ci */
577777dab0Sopenharmony_ciOH_Drawing_Brush* OH_Drawing_BrushCreate(void);
587777dab0Sopenharmony_ci
597777dab0Sopenharmony_ci/**
607777dab0Sopenharmony_ci * @brief Creates an <b>OH_Drawing_Brush</b> copy object.
617777dab0Sopenharmony_ci *
627777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
637777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
647777dab0Sopenharmony_ci * @return Returns the pointer to the <b>OH_Drawing_Brush</b> object created.
657777dab0Sopenharmony_ci *         If nullptr is returned, the creation fails.
667777dab0Sopenharmony_ci *         The possible cause of the failure is that the available memory is empty or a nullptr is passed.
677777dab0Sopenharmony_ci * @since 12
687777dab0Sopenharmony_ci * @version 1.0
697777dab0Sopenharmony_ci */
707777dab0Sopenharmony_ciOH_Drawing_Brush* OH_Drawing_BrushCopy(OH_Drawing_Brush*);
717777dab0Sopenharmony_ci
727777dab0Sopenharmony_ci/**
737777dab0Sopenharmony_ci * @brief Destroys an <b>OH_Drawing_Brush</b> object and reclaims the memory occupied by the object.
747777dab0Sopenharmony_ci *
757777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
767777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
777777dab0Sopenharmony_ci * @since 8
787777dab0Sopenharmony_ci * @version 1.0
797777dab0Sopenharmony_ci */
807777dab0Sopenharmony_civoid OH_Drawing_BrushDestroy(OH_Drawing_Brush*);
817777dab0Sopenharmony_ci
827777dab0Sopenharmony_ci/**
837777dab0Sopenharmony_ci * @brief Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled,
847777dab0Sopenharmony_ci * edges will be drawn with partial transparency.
857777dab0Sopenharmony_ci *
867777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
877777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
887777dab0Sopenharmony_ci * @return Returns <b>true</b> if anti-aliasing is enabled; returns <b>false</b> otherwise.
897777dab0Sopenharmony_ci * @since 8
907777dab0Sopenharmony_ci * @version 1.0
917777dab0Sopenharmony_ci */
927777dab0Sopenharmony_cibool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*);
937777dab0Sopenharmony_ci
947777dab0Sopenharmony_ci/**
957777dab0Sopenharmony_ci * @brief Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled,
967777dab0Sopenharmony_ci * edges will be drawn with partial transparency.
977777dab0Sopenharmony_ci *
987777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
997777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1007777dab0Sopenharmony_ci * @param bool Specifies whether to enable anti-aliasing. The value <b>true</b> means
1017777dab0Sopenharmony_ci *             to enable anti-aliasing, and <b>false</b> means the opposite.
1027777dab0Sopenharmony_ci * @since 8
1037777dab0Sopenharmony_ci * @version 1.0
1047777dab0Sopenharmony_ci */
1057777dab0Sopenharmony_civoid OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool);
1067777dab0Sopenharmony_ci
1077777dab0Sopenharmony_ci/**
1087777dab0Sopenharmony_ci * @brief Obtains the color of a brush. The color is used by the brush to fill in a shape.
1097777dab0Sopenharmony_ci *
1107777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1117777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1127777dab0Sopenharmony_ci * @return Returns a 32-bit (ARGB) variable that describes the color.
1137777dab0Sopenharmony_ci * @since 8
1147777dab0Sopenharmony_ci * @version 1.0
1157777dab0Sopenharmony_ci */
1167777dab0Sopenharmony_ciuint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*);
1177777dab0Sopenharmony_ci
1187777dab0Sopenharmony_ci/**
1197777dab0Sopenharmony_ci * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape.
1207777dab0Sopenharmony_ci *
1217777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1227777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1237777dab0Sopenharmony_ci * @param color Indicates the color to set, which is a 32-bit (ARGB) variable.
1247777dab0Sopenharmony_ci * @since 8
1257777dab0Sopenharmony_ci * @version 1.0
1267777dab0Sopenharmony_ci */
1277777dab0Sopenharmony_civoid OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color);
1287777dab0Sopenharmony_ci
1297777dab0Sopenharmony_ci/**
1307777dab0Sopenharmony_ci * @brief Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape.
1317777dab0Sopenharmony_ci *
1327777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1337777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1347777dab0Sopenharmony_ci * @return Returns a 8-bit variable that describes the alpha.
1357777dab0Sopenharmony_ci * @since 11
1367777dab0Sopenharmony_ci * @version 1.0
1377777dab0Sopenharmony_ci */
1387777dab0Sopenharmony_ciuint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*);
1397777dab0Sopenharmony_ci
1407777dab0Sopenharmony_ci/**
1417777dab0Sopenharmony_ci * @brief Sets the alpha for a brush. The alpha will be used by the brush to fill in a shape.
1427777dab0Sopenharmony_ci *
1437777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1447777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1457777dab0Sopenharmony_ci * @param alpha Indicates the alpha to set, which is a 8-bit variable.
1467777dab0Sopenharmony_ci * @since 11
1477777dab0Sopenharmony_ci * @version 1.0
1487777dab0Sopenharmony_ci */
1497777dab0Sopenharmony_civoid OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha);
1507777dab0Sopenharmony_ci
1517777dab0Sopenharmony_ci/**
1527777dab0Sopenharmony_ci * @brief Sets the shaderEffect for a brush.
1537777dab0Sopenharmony_ci *
1547777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1557777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1567777dab0Sopenharmony_ci * @param OH_Drawing_ShaderEffect Indicates the pointer to an <b>OH_Drawing_ShaderEffect</b> object.
1577777dab0Sopenharmony_ci * @since 11
1587777dab0Sopenharmony_ci * @version 1.0
1597777dab0Sopenharmony_ci */
1607777dab0Sopenharmony_civoid OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*);
1617777dab0Sopenharmony_ci
1627777dab0Sopenharmony_ci/**
1637777dab0Sopenharmony_ci * @brief Sets the shadowLayer for a brush.
1647777dab0Sopenharmony_ci *
1657777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1667777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1677777dab0Sopenharmony_ci * @param OH_Drawing_ShadowLayer Indicates the pointer to an <b>OH_Drawing_ShadowLayer</b> object.
1687777dab0Sopenharmony_ci * @since 12
1697777dab0Sopenharmony_ci * @version 1.0
1707777dab0Sopenharmony_ci */
1717777dab0Sopenharmony_civoid OH_Drawing_BrushSetShadowLayer(OH_Drawing_Brush*, OH_Drawing_ShadowLayer*);
1727777dab0Sopenharmony_ci
1737777dab0Sopenharmony_ci/**
1747777dab0Sopenharmony_ci * @brief Sets the filter for a brush.
1757777dab0Sopenharmony_ci *
1767777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1777777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1787777dab0Sopenharmony_ci * @param OH_Drawing_Filter Indicates the pointer to an <b>OH_Drawing_Filter</b> object.
1797777dab0Sopenharmony_ci * @since 11
1807777dab0Sopenharmony_ci * @version 1.0
1817777dab0Sopenharmony_ci */
1827777dab0Sopenharmony_civoid OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*);
1837777dab0Sopenharmony_ci
1847777dab0Sopenharmony_ci/**
1857777dab0Sopenharmony_ci * @brief Gets the filter from a brush.
1867777dab0Sopenharmony_ci *
1877777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1887777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
1897777dab0Sopenharmony_ci * @param OH_Drawing_Filter Indicates the pointer to an <b>OH_Drawing_Filter</b> object.
1907777dab0Sopenharmony_ci * @since 12
1917777dab0Sopenharmony_ci * @version 1.0
1927777dab0Sopenharmony_ci */
1937777dab0Sopenharmony_civoid OH_Drawing_BrushGetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*);
1947777dab0Sopenharmony_ci
1957777dab0Sopenharmony_ci/**
1967777dab0Sopenharmony_ci * @brief Sets a blender that implements the specified blendmode enum for a brush.
1977777dab0Sopenharmony_ci *
1987777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1997777dab0Sopenharmony_ci * @param OH_Drawing_Pen Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
2007777dab0Sopenharmony_ci * @param OH_Drawing_BlendMode Indicates the blend mode.
2017777dab0Sopenharmony_ci * @since 12
2027777dab0Sopenharmony_ci * @version 1.0
2037777dab0Sopenharmony_ci */
2047777dab0Sopenharmony_civoid OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode);
2057777dab0Sopenharmony_ci
2067777dab0Sopenharmony_ci/**
2077777dab0Sopenharmony_ci * @brief Resets all brush contents to their initial values.
2087777dab0Sopenharmony_ci *
2097777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
2107777dab0Sopenharmony_ci * @param OH_Drawing_Brush Indicates the pointer to an <b>OH_Drawing_Brush</b> object.
2117777dab0Sopenharmony_ci * @since 12
2127777dab0Sopenharmony_ci * @version 1.0
2137777dab0Sopenharmony_ci */
2147777dab0Sopenharmony_civoid OH_Drawing_BrushReset(OH_Drawing_Brush*);
2157777dab0Sopenharmony_ci
2167777dab0Sopenharmony_ci#ifdef __cplusplus
2177777dab0Sopenharmony_ci}
2187777dab0Sopenharmony_ci#endif
2197777dab0Sopenharmony_ci/** @} */
2207777dab0Sopenharmony_ci#endif
221