1a3e0fd82Sopenharmony_ci/*
2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License.
5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at
6a3e0fd82Sopenharmony_ci *
7a3e0fd82Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8a3e0fd82Sopenharmony_ci *
9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and
13a3e0fd82Sopenharmony_ci * limitations under the License.
14a3e0fd82Sopenharmony_ci */
15a3e0fd82Sopenharmony_ci
16a3e0fd82Sopenharmony_ci/**
17a3e0fd82Sopenharmony_ci * @addtogroup UI_Components
18a3e0fd82Sopenharmony_ci * @{
19a3e0fd82Sopenharmony_ci *
20a3e0fd82Sopenharmony_ci * @brief Defines UI components such as buttons, texts, images, lists, and progress bars.
21a3e0fd82Sopenharmony_ci *
22a3e0fd82Sopenharmony_ci * @since 1.0
23a3e0fd82Sopenharmony_ci * @version 1.0
24a3e0fd82Sopenharmony_ci */
25a3e0fd82Sopenharmony_ci
26a3e0fd82Sopenharmony_ci/**
27a3e0fd82Sopenharmony_ci * @file ui_canvas.h
28a3e0fd82Sopenharmony_ci *
29a3e0fd82Sopenharmony_ci * @brief Defines the attributes of the canvas component and provides functions for drawing rectangles,
30a3e0fd82Sopenharmony_ci *        circles, and others.
31a3e0fd82Sopenharmony_ci *
32a3e0fd82Sopenharmony_ci * @since 1.0
33a3e0fd82Sopenharmony_ci * @version 1.0
34a3e0fd82Sopenharmony_ci */
35a3e0fd82Sopenharmony_ci
36a3e0fd82Sopenharmony_ci#ifndef GRAPHIC_LITE_UI_CANVAS_H
37a3e0fd82Sopenharmony_ci#define GRAPHIC_LITE_UI_CANVAS_H
38a3e0fd82Sopenharmony_ci
39a3e0fd82Sopenharmony_ci#include "common/image.h"
40a3e0fd82Sopenharmony_ci#include "components/ui_label.h"
41a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/depiction/depict_curve.h"
42a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/depiction/depict_dash.h"
43a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/depiction/depict_stroke.h"
44a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/imagefilter/filter_blur.h"
45a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/rasterizer/rasterizer_scanline_antialias.h"
46a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/scanline/geometry_scanline.h"
47a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/spancolorfill/fill_base.h"
48a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/spancolorfill/fill_gradient.h"
49a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/spancolorfill/fill_gradient_lut.h"
50a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/spancolorfill/fill_interpolator.h"
51a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/spancolorfill/fill_pattern_rgba.h"
52a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/vertexprimitive/geometry_path_storage.h"
53a3e0fd82Sopenharmony_ci#include "ui_extend_image_view.h"
54a3e0fd82Sopenharmony_ci#include "gfx_utils/file.h"
55a3e0fd82Sopenharmony_ci#include "gfx_utils/list.h"
56a3e0fd82Sopenharmony_ci#include "gfx_utils/diagram/common/paint.h"
57a3e0fd82Sopenharmony_ci
58a3e0fd82Sopenharmony_cinamespace OHOS {
59a3e0fd82Sopenharmony_ciclass RenderBase;
60a3e0fd82Sopenharmony_ci
61a3e0fd82Sopenharmony_ci/**
62a3e0fd82Sopenharmony_ci * @brief Defines a canvas, which is used to draw multiple types of 2D graphs.
63a3e0fd82Sopenharmony_ci *
64a3e0fd82Sopenharmony_ci * @since 1.0
65a3e0fd82Sopenharmony_ci * @version 1.0
66a3e0fd82Sopenharmony_ci */
67a3e0fd82Sopenharmony_ciclass UICanvas : public UIView {
68a3e0fd82Sopenharmony_cipublic:
69a3e0fd82Sopenharmony_ci    /**
70a3e0fd82Sopenharmony_ci     * @brief A constructor used to create a <b>UICanvas</b> instance.
71a3e0fd82Sopenharmony_ci     *
72a3e0fd82Sopenharmony_ci     * @since 1.0
73a3e0fd82Sopenharmony_ci     * @version 1.0
74a3e0fd82Sopenharmony_ci     */
75a3e0fd82Sopenharmony_ci    UICanvas() : startPoint_({0, 0}), vertices_(nullptr), path_(nullptr) {}
76a3e0fd82Sopenharmony_ci
77a3e0fd82Sopenharmony_ci    /**
78a3e0fd82Sopenharmony_ci     * @brief A destructor used to delete the <b>UICanvas</b> instance.
79a3e0fd82Sopenharmony_ci     *
80a3e0fd82Sopenharmony_ci     * @since 1.0
81a3e0fd82Sopenharmony_ci     * @version 1.0
82a3e0fd82Sopenharmony_ci     */
83a3e0fd82Sopenharmony_ci    virtual ~UICanvas();
84a3e0fd82Sopenharmony_ci
85a3e0fd82Sopenharmony_ci    /**
86a3e0fd82Sopenharmony_ci     * @brief Obtains the view type.
87a3e0fd82Sopenharmony_ci     *
88a3e0fd82Sopenharmony_ci     * @return Returns the view type. For details, see {@link UIViewType}.
89a3e0fd82Sopenharmony_ci     * @since 1.0
90a3e0fd82Sopenharmony_ci     * @version 1.0
91a3e0fd82Sopenharmony_ci     */
92a3e0fd82Sopenharmony_ci    UIViewType GetViewType() const override
93a3e0fd82Sopenharmony_ci    {
94a3e0fd82Sopenharmony_ci        return UI_CANVAS;
95a3e0fd82Sopenharmony_ci    }
96a3e0fd82Sopenharmony_ci
97a3e0fd82Sopenharmony_ci    /**
98a3e0fd82Sopenharmony_ci     * @brief Clears the entire canvas.
99a3e0fd82Sopenharmony_ci     *
100a3e0fd82Sopenharmony_ci     * @since 1.0
101a3e0fd82Sopenharmony_ci     * @version 1.0
102a3e0fd82Sopenharmony_ci     */
103a3e0fd82Sopenharmony_ci    void Clear();
104a3e0fd82Sopenharmony_ci
105a3e0fd82Sopenharmony_ci    /**
106a3e0fd82Sopenharmony_ci     * @brief Sets the coordinates of the start point for drawing a line. For example, if <b>startPoint</b> is
107a3e0fd82Sopenharmony_ci     *        set to {50, 50}, the line is drawn from this set of coordinates on the canvas.
108a3e0fd82Sopenharmony_ci     *
109a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the start point.
110a3e0fd82Sopenharmony_ci     * @see GetStartPosition
111a3e0fd82Sopenharmony_ci     * @since 1.0
112a3e0fd82Sopenharmony_ci     * @version 1.0
113a3e0fd82Sopenharmony_ci     */
114a3e0fd82Sopenharmony_ci    void SetStartPosition(const Point& startPoint)
115a3e0fd82Sopenharmony_ci    {
116a3e0fd82Sopenharmony_ci        startPoint_ = startPoint;
117a3e0fd82Sopenharmony_ci    }
118a3e0fd82Sopenharmony_ci
119a3e0fd82Sopenharmony_ci    /**
120a3e0fd82Sopenharmony_ci     * @brief Obtains the coordinates of the start point of a line.
121a3e0fd82Sopenharmony_ci     *
122a3e0fd82Sopenharmony_ci     * @return Returns the coordinates of the start point.
123a3e0fd82Sopenharmony_ci     * @see SetStartPosition
124a3e0fd82Sopenharmony_ci     * @since 1.0
125a3e0fd82Sopenharmony_ci     * @version 1.0
126a3e0fd82Sopenharmony_ci     */
127a3e0fd82Sopenharmony_ci    const Point& GetStartPosition() const
128a3e0fd82Sopenharmony_ci    {
129a3e0fd82Sopenharmony_ci        return startPoint_;
130a3e0fd82Sopenharmony_ci    }
131a3e0fd82Sopenharmony_ci
132a3e0fd82Sopenharmony_ci    /**
133a3e0fd82Sopenharmony_ci     * @brief Draws a straight line.
134a3e0fd82Sopenharmony_ci     *
135a3e0fd82Sopenharmony_ci     * If {@link SetStartPosition} is not used to set the coordinates of the start point of the line, the drawing
136a3e0fd82Sopenharmony_ci     * starts from the end point of the last line.
137a3e0fd82Sopenharmony_ci     *
138a3e0fd82Sopenharmony_ci     * @param endPoint Indicates the end point of the straight line.
139a3e0fd82Sopenharmony_ci     * @param paint    Indicates the straight line style. For details, see {@link Paint}.
140a3e0fd82Sopenharmony_ci     * @since 1.0
141a3e0fd82Sopenharmony_ci     * @version 1.0
142a3e0fd82Sopenharmony_ci     */
143a3e0fd82Sopenharmony_ci    void DrawLine(const Point& endPoint, const Paint& paint);
144a3e0fd82Sopenharmony_ci
145a3e0fd82Sopenharmony_ci    /**
146a3e0fd82Sopenharmony_ci     * @brief Draws a straight line from the coordinates of the start point.
147a3e0fd82Sopenharmony_ci     *
148a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the start point.
149a3e0fd82Sopenharmony_ci     * @param endPoint   Indicates the coordinates of the end point.
150a3e0fd82Sopenharmony_ci     * @param paint      Indicates the straight line style. For details, see {@link Paint}.
151a3e0fd82Sopenharmony_ci     * @since 1.0
152a3e0fd82Sopenharmony_ci     * @version 1.0
153a3e0fd82Sopenharmony_ci     */
154a3e0fd82Sopenharmony_ci    void DrawLine(const Point& startPoint, const Point& endPoint, const Paint& paint);
155a3e0fd82Sopenharmony_ci
156a3e0fd82Sopenharmony_ci    /**
157a3e0fd82Sopenharmony_ci     * @brief Draws a cubic Bezier curve.
158a3e0fd82Sopenharmony_ci     *
159a3e0fd82Sopenharmony_ci     * If {@link SetStartPosition} is not used to set the coordinates of the start point of the curve,
160a3e0fd82Sopenharmony_ci     * the drawing starts from the end point of the last line.
161a3e0fd82Sopenharmony_ci     * Currently, the opacity cannot be set, and the maximum line width is <b>3</b>.
162a3e0fd82Sopenharmony_ci     *
163a3e0fd82Sopenharmony_ci     * @param control1 Indicates the coordinates of the first control point of the cubic Bezier curve.
164a3e0fd82Sopenharmony_ci     * @param control2 Indicates the coordinates of the second control point of the cubic Bezier curve.
165a3e0fd82Sopenharmony_ci     * @param endPoint Indicates the coordinates of the end point of the cubic Bezier curve.
166a3e0fd82Sopenharmony_ci     * @param paint    Indicates the curve style. For details, see {@link Paint}.
167a3e0fd82Sopenharmony_ci     * @since 1.0
168a3e0fd82Sopenharmony_ci     * @version 1.0
169a3e0fd82Sopenharmony_ci     */
170a3e0fd82Sopenharmony_ci    void DrawCurve(const Point& control1, const Point& control2, const Point& endPoint, const Paint& paint);
171a3e0fd82Sopenharmony_ci
172a3e0fd82Sopenharmony_ci    /**
173a3e0fd82Sopenharmony_ci     * @brief Draws a cubic Bezier curve from the start point coordinates.
174a3e0fd82Sopenharmony_ci     *
175a3e0fd82Sopenharmony_ci     * Currently, the opacity cannot be set, and the maximum line width is <b>3</b>.
176a3e0fd82Sopenharmony_ci     *
177a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the start point of the cubic Bezier curve.
178a3e0fd82Sopenharmony_ci     * @param control1   Indicates the coordinates of the first control point of the cubic Bezier curve.
179a3e0fd82Sopenharmony_ci     * @param control2   Indicates the coordinates of the second control point of the cubic Bezier curve.
180a3e0fd82Sopenharmony_ci     * @param endPoint   Indicates the coordinates of the end point of the cubic Bezier curve.
181a3e0fd82Sopenharmony_ci     * @param paint      Indicates the curve style. For details, see {@link Paint}.
182a3e0fd82Sopenharmony_ci     * @since 1.0
183a3e0fd82Sopenharmony_ci     * @version 1.0
184a3e0fd82Sopenharmony_ci     */
185a3e0fd82Sopenharmony_ci    void DrawCurve(const Point& startPoint, const Point& control1, const Point& control2,
186a3e0fd82Sopenharmony_ci                   const Point& endPoint, const Paint& paint);
187a3e0fd82Sopenharmony_ci
188a3e0fd82Sopenharmony_ci    /**
189a3e0fd82Sopenharmony_ci     * @brief Draws a rectangle.
190a3e0fd82Sopenharmony_ci     *
191a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the point at the upper left corner of the rectangle.
192a3e0fd82Sopenharmony_ci     * @param height     Indicates the height of the rectangle.
193a3e0fd82Sopenharmony_ci     * @param width      Indicates the width of the rectangle.
194a3e0fd82Sopenharmony_ci     * @param paint      Indicates the rectangle style. For details, see {@link Paint}.
195a3e0fd82Sopenharmony_ci     * @since 1.0
196a3e0fd82Sopenharmony_ci     * @version 1.0
197a3e0fd82Sopenharmony_ci     */
198a3e0fd82Sopenharmony_ci    void DrawRect(const Point& startPoint, int16_t height, int16_t width, const Paint& paint);
199a3e0fd82Sopenharmony_ci
200a3e0fd82Sopenharmony_ci#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
201a3e0fd82Sopenharmony_ci    /**
202a3e0fd82Sopenharmony_ci     * @brief Draws a rectangular path with no fill.
203a3e0fd82Sopenharmony_ci     * @param startPoint starting point
204a3e0fd82Sopenharmony_ci     * @param height
205a3e0fd82Sopenharmony_ci     * @param width
206a3e0fd82Sopenharmony_ci     * @param paint paint brush
207a3e0fd82Sopenharmony_ci     */
208a3e0fd82Sopenharmony_ci    void StrokeRect(const Point& startPoint, int16_t height, int16_t width, const Paint& paint);
209a3e0fd82Sopenharmony_ci
210a3e0fd82Sopenharmony_ci    /**
211a3e0fd82Sopenharmony_ci     * @brief Clears pixels within a rectangle
212a3e0fd82Sopenharmony_ci     * @param startPoint starting point
213a3e0fd82Sopenharmony_ci     * @param height
214a3e0fd82Sopenharmony_ci     * @param width
215a3e0fd82Sopenharmony_ci     */
216a3e0fd82Sopenharmony_ci    void ClearRect(const Point& startPoint, int16_t height, int16_t width);
217a3e0fd82Sopenharmony_ci#endif
218a3e0fd82Sopenharmony_ci
219a3e0fd82Sopenharmony_ci    /**
220a3e0fd82Sopenharmony_ci     * @brief Draws a circle.
221a3e0fd82Sopenharmony_ci     *
222a3e0fd82Sopenharmony_ci     * @param center Indicates the coordinates of the circle center.
223a3e0fd82Sopenharmony_ci     * @param radius Indicates the radius of the circle.
224a3e0fd82Sopenharmony_ci     * @param paint  Indicates the circle style. For details, see {@link Paint}.
225a3e0fd82Sopenharmony_ci     * @since 1.0
226a3e0fd82Sopenharmony_ci     * @version 1.0
227a3e0fd82Sopenharmony_ci     */
228a3e0fd82Sopenharmony_ci    void DrawCircle(const Point& center, uint16_t radius, const Paint& paint);
229a3e0fd82Sopenharmony_ci
230a3e0fd82Sopenharmony_ci    /**
231a3e0fd82Sopenharmony_ci     * @brief Draws a sector.
232a3e0fd82Sopenharmony_ci     *
233a3e0fd82Sopenharmony_ci     * When the start angle is smaller than the end angle, the sector is drawn clockwise.
234a3e0fd82Sopenharmony_ci     * Otherwise, the sector is drawn counterclockwise.
235a3e0fd82Sopenharmony_ci     *
236a3e0fd82Sopenharmony_ci     * @param center     Indicates the coordinates of the sector's center.
237a3e0fd82Sopenharmony_ci     * @param radius     Indicates the radius of the sector.
238a3e0fd82Sopenharmony_ci     * @param startAngle Indicates the start angle of the sector. Value <b>0</b> indicates the 12-o'clock direction,
239a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
240a3e0fd82Sopenharmony_ci     * @param endAngle   Indicates the end angle of the sector. Value <b>0</b> indicates the 12-o'clock direction,
241a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
242a3e0fd82Sopenharmony_ci     * @param paint      Indicates the sector style. For details, see {@link Paint}.
243a3e0fd82Sopenharmony_ci     * @since 1.0
244a3e0fd82Sopenharmony_ci     * @version 1.0
245a3e0fd82Sopenharmony_ci     */
246a3e0fd82Sopenharmony_ci    void DrawSector(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle, const Paint& paint);
247a3e0fd82Sopenharmony_ci
248a3e0fd82Sopenharmony_ci    /**
249a3e0fd82Sopenharmony_ci     * @brief Draws an arc.
250a3e0fd82Sopenharmony_ci     *
251a3e0fd82Sopenharmony_ci     * Only stroke is supported. \n
252a3e0fd82Sopenharmony_ci     * When the start angle is smaller than the end angle, the sector is drawn clockwise.
253a3e0fd82Sopenharmony_ci     * Otherwise, the sector is drawn counterclockwise. \n
254a3e0fd82Sopenharmony_ci    *
255a3e0fd82Sopenharmony_ci     * @param center     Indicates the coordinates of the arc's center.
256a3e0fd82Sopenharmony_ci     * @param radius     Indicates the radius of the arc.
257a3e0fd82Sopenharmony_ci     * @param startAngle Indicates the start angle of the arc. Value <b>0</b> indicates the 12-o'clock direction,
258a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
259a3e0fd82Sopenharmony_ci     * @param endAngle   Indicates the end angle of the arc. Value <b>0</b> indicates the 12-o'clock direction,
260a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
261a3e0fd82Sopenharmony_ci     * @param paint      Indicates the arc style. For details, see {@link Paint}.
262a3e0fd82Sopenharmony_ci     * @since 1.0
263a3e0fd82Sopenharmony_ci     * @version 1.0
264a3e0fd82Sopenharmony_ci     */
265a3e0fd82Sopenharmony_ci    void DrawArc(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle, const Paint& paint);
266a3e0fd82Sopenharmony_ci
267a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_DRAW_IMAGE_FLAG) && GRAPHIC_ENABLE_DRAW_IMAGE_FLAG
268a3e0fd82Sopenharmony_ci    /**
269a3e0fd82Sopenharmony_ci     * @brief Draws an image.
270a3e0fd82Sopenharmony_ci     *
271a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the start point.
272a3e0fd82Sopenharmony_ci     * @param image      Indicates the pointer to the image source.
273a3e0fd82Sopenharmony_ci     * @param paint      Indicates the image style. For details, see {@link Paint}.
274a3e0fd82Sopenharmony_ci     * @since 1.0
275a3e0fd82Sopenharmony_ci     * @version 1.0
276a3e0fd82Sopenharmony_ci     */
277a3e0fd82Sopenharmony_ci    void DrawImage(const Point& startPoint, const char* image, const Paint& paint);
278a3e0fd82Sopenharmony_ci
279a3e0fd82Sopenharmony_ci    void DrawImage(const Point& startPoint, const char* image, const Paint& paint, int16_t width, int16_t height);
280a3e0fd82Sopenharmony_ci#endif
281a3e0fd82Sopenharmony_ci    /**
282a3e0fd82Sopenharmony_ci     * @brief Defines the font style.
283a3e0fd82Sopenharmony_ci     */
284a3e0fd82Sopenharmony_ci    struct FontStyle : public HeapBase {
285a3e0fd82Sopenharmony_ci        /** Text direction. For details, see {@link UITextLanguageDirect}. */
286a3e0fd82Sopenharmony_ci        UITextLanguageDirect direct;
287a3e0fd82Sopenharmony_ci        /** Text alignment mode. For details, see {@link UITextLanguageAlignment}. */
288a3e0fd82Sopenharmony_ci        UITextLanguageAlignment align;
289a3e0fd82Sopenharmony_ci        /** Font size */
290a3e0fd82Sopenharmony_ci        uint8_t fontSize;
291a3e0fd82Sopenharmony_ci        /** Letter-spacing */
292a3e0fd82Sopenharmony_ci        int16_t letterSpace;
293a3e0fd82Sopenharmony_ci        /** Font name */
294a3e0fd82Sopenharmony_ci        const char* fontName;
295a3e0fd82Sopenharmony_ci    };
296a3e0fd82Sopenharmony_ci
297a3e0fd82Sopenharmony_ci    struct DrawCmd : public HeapBase {
298a3e0fd82Sopenharmony_ci        Paint paint;
299a3e0fd82Sopenharmony_ci        void* param;
300a3e0fd82Sopenharmony_ci        void (*DrawGraphics)(BufferInfo&, void*, const Paint&, const Rect&, const Rect&, const Style&);
301a3e0fd82Sopenharmony_ci        void (*DeleteParam)(void*);
302a3e0fd82Sopenharmony_ci    };
303a3e0fd82Sopenharmony_ci
304a3e0fd82Sopenharmony_ci    /**
305a3e0fd82Sopenharmony_ci     * @brief Draws text.
306a3e0fd82Sopenharmony_ci     *
307a3e0fd82Sopenharmony_ci     * Only fill is supported. \n
308a3e0fd82Sopenharmony_ci     * If the text length exceeds the value of <b>maxWidth</b>, the text will be truncated. \n
309a3e0fd82Sopenharmony_ci     *
310a3e0fd82Sopenharmony_ci     * @param startPoint Indicates the coordinates of the start point.
311a3e0fd82Sopenharmony_ci     * @param text       Indicates the pointer to the text content.
312a3e0fd82Sopenharmony_ci     * @param maxWidth   Indicates the maximum width of the text that can be displayed. If the maximum width is
313a3e0fd82Sopenharmony_ci     *                   exceeded, the text is truncated.
314a3e0fd82Sopenharmony_ci     * @param fontStyle  Indicates the text layout and font style. For details, see {@link FontStyle}.
315a3e0fd82Sopenharmony_ci     * @param paint      Indicates the text style. For details, see {@link Paint}.
316a3e0fd82Sopenharmony_ci     * @since 1.0
317a3e0fd82Sopenharmony_ci     * @version 1.0
318a3e0fd82Sopenharmony_ci     */
319a3e0fd82Sopenharmony_ci    void DrawLabel(const Point& startPoint, const char* text, uint16_t maxWidth, const FontStyle& fontStyle,
320a3e0fd82Sopenharmony_ci                   const Paint& paint);
321a3e0fd82Sopenharmony_ci
322a3e0fd82Sopenharmony_ci    /**
323a3e0fd82Sopenharmony_ci     * @brief Creates a path.
324a3e0fd82Sopenharmony_ci     *
325a3e0fd82Sopenharmony_ci     * A round corner can be used to join two lines. Currently, miter and bevel joints are not supported.
326a3e0fd82Sopenharmony_ci     * To draw this path, you need to call {@link DrawPath}.
327a3e0fd82Sopenharmony_ci     *
328a3e0fd82Sopenharmony_ci     * @since 3.0
329a3e0fd82Sopenharmony_ci     * @version 5.0
330a3e0fd82Sopenharmony_ci     */
331a3e0fd82Sopenharmony_ci    void BeginPath();
332a3e0fd82Sopenharmony_ci
333a3e0fd82Sopenharmony_ci    /**
334a3e0fd82Sopenharmony_ci     * @brief Moves the start point of this path to a specified point.
335a3e0fd82Sopenharmony_ci     *
336a3e0fd82Sopenharmony_ci     * @param point Indicates the specified point to move to.
337a3e0fd82Sopenharmony_ci     * @since 3.0
338a3e0fd82Sopenharmony_ci     * @version 5.0
339a3e0fd82Sopenharmony_ci     */
340a3e0fd82Sopenharmony_ci    void MoveTo(const Point& point);
341a3e0fd82Sopenharmony_ci
342a3e0fd82Sopenharmony_ci    /**
343a3e0fd82Sopenharmony_ci     * @brief Creates a straight line from the end point of this path to a specified point.
344a3e0fd82Sopenharmony_ci     *
345a3e0fd82Sopenharmony_ci     * @param point Indicates the coordinates of the specified point.
346a3e0fd82Sopenharmony_ci     * @since 3.0
347a3e0fd82Sopenharmony_ci     * @version 5.0
348a3e0fd82Sopenharmony_ci     */
349a3e0fd82Sopenharmony_ci    void LineTo(const Point& point);
350a3e0fd82Sopenharmony_ci
351a3e0fd82Sopenharmony_ci    /**
352a3e0fd82Sopenharmony_ci     * @brief Creates an arc path.
353a3e0fd82Sopenharmony_ci     *
354a3e0fd82Sopenharmony_ci     * @param center     Indicates the coordinates of the arc's center point.
355a3e0fd82Sopenharmony_ci     * @param radius     Indicates the radius of the arc.
356a3e0fd82Sopenharmony_ci     * @param startAngle Indicates the start angle of the arc.
357a3e0fd82Sopenharmony_ci     *                   The value <b>0</b> indicates the 12-o'clock direction,
358a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
359a3e0fd82Sopenharmony_ci     * @param endAngle   Indicates the end angle of the arc.
360a3e0fd82Sopenharmony_ci     *                   The value <b>0</b> indicates the 12-o'clock direction,
361a3e0fd82Sopenharmony_ci     *                   and <b>90</b> indicates the 3-o'clock direction.
362a3e0fd82Sopenharmony_ci     * @since 3.0
363a3e0fd82Sopenharmony_ci     * @version 5.0
364a3e0fd82Sopenharmony_ci     */
365a3e0fd82Sopenharmony_ci    void ArcTo(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle);
366a3e0fd82Sopenharmony_ci
367a3e0fd82Sopenharmony_ci    /**
368a3e0fd82Sopenharmony_ci     * @brief Creates a rectangular path.
369a3e0fd82Sopenharmony_ci     *
370a3e0fd82Sopenharmony_ci     * @param point  Indicates the coordinates of the rectangle's upper left corner.
371a3e0fd82Sopenharmony_ci     * @param height Indicates the height of the rectangle.
372a3e0fd82Sopenharmony_ci     * @param width  Indicates the width of the rectangle.
373a3e0fd82Sopenharmony_ci     * @since 3.0
374a3e0fd82Sopenharmony_ci     * @version 5.0
375a3e0fd82Sopenharmony_ci     */
376a3e0fd82Sopenharmony_ci    void AddRect(const Point& point, int16_t height, int16_t width);
377a3e0fd82Sopenharmony_ci
378a3e0fd82Sopenharmony_ci    /**
379a3e0fd82Sopenharmony_ci     * @brief Closes this path.
380a3e0fd82Sopenharmony_ci     *
381a3e0fd82Sopenharmony_ci     * @since 3.0
382a3e0fd82Sopenharmony_ci     * @version 5.0
383a3e0fd82Sopenharmony_ci     */
384a3e0fd82Sopenharmony_ci    void ClosePath();
385a3e0fd82Sopenharmony_ci
386a3e0fd82Sopenharmony_ci    /**
387a3e0fd82Sopenharmony_ci     * @brief Draws this path.
388a3e0fd82Sopenharmony_ci     *
389a3e0fd82Sopenharmony_ci     * @param paint Indicates the path style. For details, see {@link Paint}.
390a3e0fd82Sopenharmony_ci     * @since 3.0
391a3e0fd82Sopenharmony_ci     * @version 5.0
392a3e0fd82Sopenharmony_ci     */
393a3e0fd82Sopenharmony_ci    void DrawPath(const Paint& paint);
394a3e0fd82Sopenharmony_ci
395a3e0fd82Sopenharmony_ci#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
396a3e0fd82Sopenharmony_ci    /**
397a3e0fd82Sopenharmony_ci     * @brief Fill polygon path
398a3e0fd82Sopenharmony_ci     * @param paint fill paint
399a3e0fd82Sopenharmony_ci     * @since 3.0
400a3e0fd82Sopenharmony_ci     * @version 5.0
401a3e0fd82Sopenharmony_ci     */
402a3e0fd82Sopenharmony_ci    void FillPath(const Paint& paint);
403a3e0fd82Sopenharmony_ci#endif
404a3e0fd82Sopenharmony_ci
405a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
406a3e0fd82Sopenharmony_ci    /*  Draw text on canvas */
407a3e0fd82Sopenharmony_ci    void StrokeText(const char* text, const Point& point, const FontStyle& fontStyle, const Paint& paint);
408a3e0fd82Sopenharmony_ci#endif
409a3e0fd82Sopenharmony_ci
410a3e0fd82Sopenharmony_ci    /* Returns an object containing the specified text width */
411a3e0fd82Sopenharmony_ci    Point MeasureText(const char* text, const FontStyle& fontStyle);
412a3e0fd82Sopenharmony_ci
413a3e0fd82Sopenharmony_ci    /* Save history status */
414a3e0fd82Sopenharmony_ci    void Save(Paint paint)
415a3e0fd82Sopenharmony_ci    {
416a3e0fd82Sopenharmony_ci        paintStack_.PushBack(paint);
417a3e0fd82Sopenharmony_ci    }
418a3e0fd82Sopenharmony_ci
419a3e0fd82Sopenharmony_ci    /**
420a3e0fd82Sopenharmony_ci     * @brief Restore to last historical state
421a3e0fd82Sopenharmony_ci     * @return Returns the last paint value.
422a3e0fd82Sopenharmony_ci     * @since 3.0
423a3e0fd82Sopenharmony_ci     * @version 5.0
424a3e0fd82Sopenharmony_ci     */
425a3e0fd82Sopenharmony_ci    Paint Restore()
426a3e0fd82Sopenharmony_ci    {
427a3e0fd82Sopenharmony_ci        Paint paint;
428a3e0fd82Sopenharmony_ci        if (paintStack_.IsEmpty()) {
429a3e0fd82Sopenharmony_ci            return paint;
430a3e0fd82Sopenharmony_ci        }
431a3e0fd82Sopenharmony_ci        paint = paintStack_.Back();
432a3e0fd82Sopenharmony_ci        paintStack_.PopBack();
433a3e0fd82Sopenharmony_ci        return paint;
434a3e0fd82Sopenharmony_ci    }
435a3e0fd82Sopenharmony_ci
436a3e0fd82Sopenharmony_ci#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
437a3e0fd82Sopenharmony_ci    void OnBlendDraw(BufferInfo& gfxDstBuffer, const Rect& trunc);
438a3e0fd82Sopenharmony_ci#endif
439a3e0fd82Sopenharmony_ci
440a3e0fd82Sopenharmony_ci    void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override;
441a3e0fd82Sopenharmony_ci
442a3e0fd82Sopenharmony_ci    static void BlendRaster(const Paint& paint,
443a3e0fd82Sopenharmony_ci                        void* param,
444a3e0fd82Sopenharmony_ci                        RasterizerScanlineAntialias& blendRasterizer,
445a3e0fd82Sopenharmony_ci                        RasterizerScanlineAntialias& rasterizer,
446a3e0fd82Sopenharmony_ci                        RenderBase& renBase,
447a3e0fd82Sopenharmony_ci                        TransAffine& transform,
448a3e0fd82Sopenharmony_ci                        SpanBase& spanGen,
449a3e0fd82Sopenharmony_ci                        const Rect& rect,
450a3e0fd82Sopenharmony_ci                        bool isStroke);
451a3e0fd82Sopenharmony_ci    static void DeleteImageParam(void* param);
452a3e0fd82Sopenharmony_ci    static void DeletePathParam(void* param);
453a3e0fd82Sopenharmony_ciprotected:
454a3e0fd82Sopenharmony_ci    constexpr static uint8_t MAX_CURVE_WIDTH = 3;
455a3e0fd82Sopenharmony_ci
456a3e0fd82Sopenharmony_ci    struct LineParam : public HeapBase {
457a3e0fd82Sopenharmony_ci        Point start;
458a3e0fd82Sopenharmony_ci        Point end;
459a3e0fd82Sopenharmony_ci    };
460a3e0fd82Sopenharmony_ci
461a3e0fd82Sopenharmony_ci    struct CurveParam : public HeapBase {
462a3e0fd82Sopenharmony_ci        Point start;
463a3e0fd82Sopenharmony_ci        Point control1;
464a3e0fd82Sopenharmony_ci        Point control2;
465a3e0fd82Sopenharmony_ci        Point end;
466a3e0fd82Sopenharmony_ci    };
467a3e0fd82Sopenharmony_ci
468a3e0fd82Sopenharmony_ci    struct RectParam : public HeapBase {
469a3e0fd82Sopenharmony_ci        Point start;
470a3e0fd82Sopenharmony_ci        int16_t height;
471a3e0fd82Sopenharmony_ci        int16_t width;
472a3e0fd82Sopenharmony_ci    };
473a3e0fd82Sopenharmony_ci
474a3e0fd82Sopenharmony_ci    struct CircleParam : public HeapBase {
475a3e0fd82Sopenharmony_ci        Point center;
476a3e0fd82Sopenharmony_ci        uint16_t radius;
477a3e0fd82Sopenharmony_ci    };
478a3e0fd82Sopenharmony_ci
479a3e0fd82Sopenharmony_ci    struct ArcParam : public HeapBase {
480a3e0fd82Sopenharmony_ci        Point center;
481a3e0fd82Sopenharmony_ci        uint16_t radius;
482a3e0fd82Sopenharmony_ci        int16_t startAngle;
483a3e0fd82Sopenharmony_ci        int16_t endAngle;
484a3e0fd82Sopenharmony_ci    };
485a3e0fd82Sopenharmony_ci
486a3e0fd82Sopenharmony_ci    enum PathCmd {
487a3e0fd82Sopenharmony_ci        CMD_MOVE_TO,
488a3e0fd82Sopenharmony_ci        CMD_LINE_TO,
489a3e0fd82Sopenharmony_ci        CMD_ARC,
490a3e0fd82Sopenharmony_ci        CMD_CLOSE,
491a3e0fd82Sopenharmony_ci    };
492a3e0fd82Sopenharmony_ci
493a3e0fd82Sopenharmony_ci    class UICanvasPath : public HeapBase {
494a3e0fd82Sopenharmony_ci    public:
495a3e0fd82Sopenharmony_ci        UICanvasPath() : startPos_({ 0, 0 }), strokeCount_(0) {};
496a3e0fd82Sopenharmony_ci        ~UICanvasPath();
497a3e0fd82Sopenharmony_ci        List<Point> points_;
498a3e0fd82Sopenharmony_ci        List<PathCmd> cmd_;
499a3e0fd82Sopenharmony_ci        List<ArcParam> arcParam_;
500a3e0fd82Sopenharmony_ci        Point startPos_;
501a3e0fd82Sopenharmony_ci        uint16_t strokeCount_;
502a3e0fd82Sopenharmony_ci    };
503a3e0fd82Sopenharmony_ci
504a3e0fd82Sopenharmony_ci#if (!(defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND))
505a3e0fd82Sopenharmony_ci    struct PathParam : public HeapBase {
506a3e0fd82Sopenharmony_ci        UICanvasPath* path;
507a3e0fd82Sopenharmony_ci        uint16_t count;
508a3e0fd82Sopenharmony_ci    };
509a3e0fd82Sopenharmony_ci
510a3e0fd82Sopenharmony_ci    struct ImageParam : public HeapBase {
511a3e0fd82Sopenharmony_ci        Point start;
512a3e0fd82Sopenharmony_ci        uint16_t height;
513a3e0fd82Sopenharmony_ci        uint16_t width;
514a3e0fd82Sopenharmony_ci        Image* image;
515a3e0fd82Sopenharmony_ci    };
516a3e0fd82Sopenharmony_ci#endif
517a3e0fd82Sopenharmony_ci
518a3e0fd82Sopenharmony_ci    struct TextParam : public HeapBase {
519a3e0fd82Sopenharmony_ci        const char* text;
520a3e0fd82Sopenharmony_ci        Point position;
521a3e0fd82Sopenharmony_ci        Color32 fontColor;
522a3e0fd82Sopenharmony_ci        uint8_t fontOpa;
523a3e0fd82Sopenharmony_ci        FontStyle fontStyle;
524a3e0fd82Sopenharmony_ci        Text* textComment;
525a3e0fd82Sopenharmony_ci        TextParam() : text(nullptr), position({0, 0}), fontOpa(0)
526a3e0fd82Sopenharmony_ci        {
527a3e0fd82Sopenharmony_ci            fontColor.full = 0;
528a3e0fd82Sopenharmony_ci            fontStyle.direct = UITextLanguageDirect::TEXT_DIRECT_LTR;
529a3e0fd82Sopenharmony_ci            fontStyle.align = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT;
530a3e0fd82Sopenharmony_ci            fontStyle.fontSize = 0;
531a3e0fd82Sopenharmony_ci            fontStyle.letterSpace = 0;
532a3e0fd82Sopenharmony_ci            fontStyle.fontName = nullptr;
533a3e0fd82Sopenharmony_ci            textComment = new Text;
534a3e0fd82Sopenharmony_ci        }
535a3e0fd82Sopenharmony_ci
536a3e0fd82Sopenharmony_ci        ~TextParam()
537a3e0fd82Sopenharmony_ci        {
538a3e0fd82Sopenharmony_ci            if (textComment) {
539a3e0fd82Sopenharmony_ci                delete textComment;
540a3e0fd82Sopenharmony_ci                textComment = nullptr;
541a3e0fd82Sopenharmony_ci            }
542a3e0fd82Sopenharmony_ci        };
543a3e0fd82Sopenharmony_ci    };
544a3e0fd82Sopenharmony_ci
545a3e0fd82Sopenharmony_ci    Point startPoint_;
546a3e0fd82Sopenharmony_ci    UICanvasVertices* vertices_;
547a3e0fd82Sopenharmony_ci    UICanvasPath* path_;
548a3e0fd82Sopenharmony_ci    List<DrawCmd> drawCmdList_;
549a3e0fd82Sopenharmony_ci    // Save historical modification information of paint
550a3e0fd82Sopenharmony_ci    List<Paint> paintStack_;
551a3e0fd82Sopenharmony_ci    static BufferInfo* gfxMapBuffer_;
552a3e0fd82Sopenharmony_ci
553a3e0fd82Sopenharmony_ci    static void DeleteLineParam(void* param)
554a3e0fd82Sopenharmony_ci    {
555a3e0fd82Sopenharmony_ci        LineParam* lineParam = static_cast<LineParam*>(param);
556a3e0fd82Sopenharmony_ci        delete lineParam;
557a3e0fd82Sopenharmony_ci    }
558a3e0fd82Sopenharmony_ci
559a3e0fd82Sopenharmony_ci    static void DeleteCurveParam(void* param)
560a3e0fd82Sopenharmony_ci    {
561a3e0fd82Sopenharmony_ci        CurveParam* curveParam = static_cast<CurveParam*>(param);
562a3e0fd82Sopenharmony_ci        delete curveParam;
563a3e0fd82Sopenharmony_ci    }
564a3e0fd82Sopenharmony_ci
565a3e0fd82Sopenharmony_ci    static void DeleteRectParam(void* param)
566a3e0fd82Sopenharmony_ci    {
567a3e0fd82Sopenharmony_ci        RectParam* rectParam = static_cast<RectParam*>(param);
568a3e0fd82Sopenharmony_ci        delete rectParam;
569a3e0fd82Sopenharmony_ci    }
570a3e0fd82Sopenharmony_ci
571a3e0fd82Sopenharmony_ci    static void DeleteCircleParam(void* param)
572a3e0fd82Sopenharmony_ci    {
573a3e0fd82Sopenharmony_ci        CircleParam* circleParam = static_cast<CircleParam*>(param);
574a3e0fd82Sopenharmony_ci        delete circleParam;
575a3e0fd82Sopenharmony_ci    }
576a3e0fd82Sopenharmony_ci
577a3e0fd82Sopenharmony_ci    static void DeleteArcParam(void* param)
578a3e0fd82Sopenharmony_ci    {
579a3e0fd82Sopenharmony_ci        ArcParam* arcParam = static_cast<ArcParam*>(param);
580a3e0fd82Sopenharmony_ci        delete arcParam;
581a3e0fd82Sopenharmony_ci    }
582a3e0fd82Sopenharmony_ci
583a3e0fd82Sopenharmony_ci    static void DeleteLabel(void* param)
584a3e0fd82Sopenharmony_ci    {
585a3e0fd82Sopenharmony_ci        UILabel* label = static_cast<UILabel*>(param);
586a3e0fd82Sopenharmony_ci        delete label;
587a3e0fd82Sopenharmony_ci    }
588a3e0fd82Sopenharmony_ci
589a3e0fd82Sopenharmony_ci    static void DeleteImageView(void* param)
590a3e0fd82Sopenharmony_ci    {
591a3e0fd82Sopenharmony_ci        UIExtendImageView* imageView = static_cast<UIExtendImageView*>(param);
592a3e0fd82Sopenharmony_ci        delete imageView;
593a3e0fd82Sopenharmony_ci    }
594a3e0fd82Sopenharmony_ci
595a3e0fd82Sopenharmony_ci    static void DeleteTextParam(void* param)
596a3e0fd82Sopenharmony_ci    {
597a3e0fd82Sopenharmony_ci        TextParam* textParam = static_cast<TextParam*>(param);
598a3e0fd82Sopenharmony_ci        delete textParam;
599a3e0fd82Sopenharmony_ci    }
600a3e0fd82Sopenharmony_ci
601a3e0fd82Sopenharmony_ci    static void DoDrawLine(BufferInfo& gfxDstBuffer,
602a3e0fd82Sopenharmony_ci                           void* param,
603a3e0fd82Sopenharmony_ci                           const Paint& paint,
604a3e0fd82Sopenharmony_ci                           const Rect& rect,
605a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea,
606a3e0fd82Sopenharmony_ci                           const Style& style);
607a3e0fd82Sopenharmony_ci    static void DoDrawCurve(BufferInfo& gfxDstBuffer,
608a3e0fd82Sopenharmony_ci                            void* param,
609a3e0fd82Sopenharmony_ci                            const Paint& paint,
610a3e0fd82Sopenharmony_ci                            const Rect& rect,
611a3e0fd82Sopenharmony_ci                            const Rect& invalidatedArea,
612a3e0fd82Sopenharmony_ci                            const Style& style);
613a3e0fd82Sopenharmony_ci    static void DoDrawRect(BufferInfo& gfxDstBuffer,
614a3e0fd82Sopenharmony_ci                           void* param,
615a3e0fd82Sopenharmony_ci                           const Paint& paint,
616a3e0fd82Sopenharmony_ci                           const Rect& rect,
617a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea,
618a3e0fd82Sopenharmony_ci                           const Style& style);
619a3e0fd82Sopenharmony_ci    static void DoFillRect(BufferInfo& gfxDstBuffer,
620a3e0fd82Sopenharmony_ci                           void* param,
621a3e0fd82Sopenharmony_ci                           const Paint& paint,
622a3e0fd82Sopenharmony_ci                           const Rect& rect,
623a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea,
624a3e0fd82Sopenharmony_ci                           const Style& style);
625a3e0fd82Sopenharmony_ci    static void DoDrawCircle(BufferInfo& gfxDstBuffer,
626a3e0fd82Sopenharmony_ci                             void* param,
627a3e0fd82Sopenharmony_ci                             const Paint& paint,
628a3e0fd82Sopenharmony_ci                             const Rect& rect,
629a3e0fd82Sopenharmony_ci                             const Rect& invalidatedArea,
630a3e0fd82Sopenharmony_ci                             const Style& style);
631a3e0fd82Sopenharmony_ci    static void DoDrawArc(BufferInfo& gfxDstBuffer,
632a3e0fd82Sopenharmony_ci                          void* param,
633a3e0fd82Sopenharmony_ci                          const Paint& paint,
634a3e0fd82Sopenharmony_ci                          const Rect& rect,
635a3e0fd82Sopenharmony_ci                          const Rect& invalidatedArea,
636a3e0fd82Sopenharmony_ci                          const Style& style);
637a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_DRAW_IMAGE_FLAG) && GRAPHIC_ENABLE_DRAW_IMAGE_FLAG
638a3e0fd82Sopenharmony_ci    static void DoDrawImage(BufferInfo& gfxDstBuffer,
639a3e0fd82Sopenharmony_ci                            void* param,
640a3e0fd82Sopenharmony_ci                            const Paint& paint,
641a3e0fd82Sopenharmony_ci                            const Rect& rect,
642a3e0fd82Sopenharmony_ci                            const Rect& invalidatedArea,
643a3e0fd82Sopenharmony_ci                            const Style& style);
644a3e0fd82Sopenharmony_ci#endif
645a3e0fd82Sopenharmony_ci
646a3e0fd82Sopenharmony_ci    static void DoDrawLabel(BufferInfo& gfxDstBuffer,
647a3e0fd82Sopenharmony_ci                            void* param,
648a3e0fd82Sopenharmony_ci                            const Paint& paint,
649a3e0fd82Sopenharmony_ci                            const Rect& rect,
650a3e0fd82Sopenharmony_ci                            const Rect& invalidatedArea,
651a3e0fd82Sopenharmony_ci                            const Style& style);
652a3e0fd82Sopenharmony_ci    static void DoDrawPath(BufferInfo& gfxDstBuffer,
653a3e0fd82Sopenharmony_ci                           void* param,
654a3e0fd82Sopenharmony_ci                           const Paint& paint,
655a3e0fd82Sopenharmony_ci                           const Rect& rect,
656a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea,
657a3e0fd82Sopenharmony_ci                           const Style& style);
658a3e0fd82Sopenharmony_ci    static void GetAbsolutePosition(const Point& prePoint, const Rect& rect, const Style& style, Point& point);
659a3e0fd82Sopenharmony_ci    static void DoDrawLineJoin(BufferInfo& gfxDstBuffer,
660a3e0fd82Sopenharmony_ci                               const Point& center,
661a3e0fd82Sopenharmony_ci                               const Rect& invalidatedArea,
662a3e0fd82Sopenharmony_ci                               const Paint& paint);
663a3e0fd82Sopenharmony_ci
664a3e0fd82Sopenharmony_ci    static void DoFillPath(BufferInfo& gfxDstBuffer,
665a3e0fd82Sopenharmony_ci                           void* param,
666a3e0fd82Sopenharmony_ci                           const Paint& paint,
667a3e0fd82Sopenharmony_ci                           const Rect& rect,
668a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea,
669a3e0fd82Sopenharmony_ci                           const Style& style);
670a3e0fd82Sopenharmony_ci
671a3e0fd82Sopenharmony_ci    static void  BlitMapBuffer(BufferInfo &gfxDstBuffer, BufferInfo& gfxMapBuffer,
672a3e0fd82Sopenharmony_ci                              Rect& textRect, TransformMap& transMap, const Rect& invalidatedArea);
673a3e0fd82Sopenharmony_ci
674a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_DRAW_TEXT_FLAG) && GRAPHIC_ENABLE_DRAW_TEXT_FLAG
675a3e0fd82Sopenharmony_ci    static void DoDrawText(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect,
676a3e0fd82Sopenharmony_ci                           const Rect& invalidatedArea, const Style& style);
677a3e0fd82Sopenharmony_ci#endif
678a3e0fd82Sopenharmony_ci    /**
679a3e0fd82Sopenharmony_ci     * Assembly parameter setting lineweight,LineCap,LineJoin
680a3e0fd82Sopenharmony_ci     */
681a3e0fd82Sopenharmony_ci    template <class LineStyle>
682a3e0fd82Sopenharmony_ci    static void LineStyleCalc(DepictStroke<LineStyle>& strokeLineStyle, const Paint& paint)
683a3e0fd82Sopenharmony_ci    {
684a3e0fd82Sopenharmony_ci        strokeLineStyle.SetWidth(paint.GetStrokeWidth()); // Line style related
685a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_LINECAP_FLAG) && GRAPHIC_ENABLE_LINECAP_FLAG
686a3e0fd82Sopenharmony_ci        strokeLineStyle.SetLineCap(paint.GetLineCap());
687a3e0fd82Sopenharmony_ci#endif
688a3e0fd82Sopenharmony_ci#if defined(GRAPHIC_ENABLE_LINEJOIN_FLAG) && GRAPHIC_ENABLE_LINEJOIN_FLAG
689a3e0fd82Sopenharmony_ci        strokeLineStyle.SetLineJoin(paint.GetLineJoin());
690a3e0fd82Sopenharmony_ci        if (paint.GetMiterLimit() > 0) {
691a3e0fd82Sopenharmony_ci            strokeLineStyle.SetMiterLimit(paint.GetMiterLimit());
692a3e0fd82Sopenharmony_ci        }
693a3e0fd82Sopenharmony_ci#endif
694a3e0fd82Sopenharmony_ci    };
695a3e0fd82Sopenharmony_ci
696a3e0fd82Sopenharmony_ci    static bool IsSoild(const Paint& paint)
697a3e0fd82Sopenharmony_ci    {
698a3e0fd82Sopenharmony_ci        if (paint.GetStyle() == Paint::STROKE_STYLE ||
699a3e0fd82Sopenharmony_ci           paint.GetStyle() == Paint::FILL_STYLE ||
700a3e0fd82Sopenharmony_ci           paint.GetStyle() == Paint::STROKE_FILL_STYLE) {
701a3e0fd82Sopenharmony_ci            return true;
702a3e0fd82Sopenharmony_ci        }
703a3e0fd82Sopenharmony_ci        return false;
704a3e0fd82Sopenharmony_ci    }
705a3e0fd82Sopenharmony_ci
706a3e0fd82Sopenharmony_ci    void DrawRectSetCmd(const Point& startPoint, int16_t height, int16_t width, const Paint& paint,
707a3e0fd82Sopenharmony_ci                        Paint::PaintStyle paintStyle);
708a3e0fd82Sopenharmony_ci    static void InitGfxMapBuffer(const BufferInfo& srcBuff, const Rect& rect);
709a3e0fd82Sopenharmony_ci    static BufferInfo* UpdateMapBufferInfo(const BufferInfo& srcBuff, const Rect& rect);
710a3e0fd82Sopenharmony_ci    static void DestroyMapBufferInfo();
711a3e0fd82Sopenharmony_ci    void SetArcParamInfo(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle);
712a3e0fd82Sopenharmony_ci#if defined(ENABLE_CANVAS_EXTEND) && ENABLE_CANVAS_EXTEND
713a3e0fd82Sopenharmony_ci    void SetDrawLinePath(const Point& startPoint, int16_t height, int16_t width, const Paint& paint);
714a3e0fd82Sopenharmony_ci#endif
715a3e0fd82Sopenharmony_ci};
716a3e0fd82Sopenharmony_ci} // namespace OHOS
717a3e0fd82Sopenharmony_ci#endif // GRAPHIC_LITE_UI_CANVAS_H
718