You need to sign in or sign up before continuing.
ui_canvas.h 22.6 KB
Newer Older
M
mamingshuai 已提交
1
/*
2
 * Copyright (c) 2020-2022 Huawei Device Co., Ltd.
M
mamingshuai 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
 * 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.
 */

/**
 * @addtogroup UI_Components
 * @{
 *
 * @brief Defines UI components such as buttons, texts, images, lists, and progress bars.
 *
 * @since 1.0
 * @version 1.0
 */

/**
 * @file ui_canvas.h
 *
 * @brief Defines the attributes of the canvas component and provides functions for drawing rectangles,
 *        circles, and others.
 *
 * @since 1.0
 * @version 1.0
 */

#ifndef GRAPHIC_LITE_UI_CANVAS_H
#define GRAPHIC_LITE_UI_CANVAS_H

#include "common/image.h"
#include "components/ui_label.h"
41 42 43 44 45 46 47 48 49 50 51 52
#include "gfx_utils/diagram/depiction/depict_curve.h"
#include "gfx_utils/diagram/depiction/depict_dash.h"
#include "gfx_utils/diagram/depiction/depict_stroke.h"
#include "gfx_utils/diagram/imagefilter/filter_blur.h"
#include "gfx_utils/diagram/rasterizer/rasterizer_scanline_antialias.h"
#include "gfx_utils/diagram/scanline/geometry_scanline.h"
#include "gfx_utils/diagram/spancolorfill/fill_base.h"
#include "gfx_utils/diagram/spancolorfill/fill_gradient.h"
#include "gfx_utils/diagram/spancolorfill/fill_gradient_lut.h"
#include "gfx_utils/diagram/spancolorfill/fill_interpolator.h"
#include "gfx_utils/diagram/spancolorfill/fill_pattern_rgba.h"
#include "gfx_utils/diagram/vertexprimitive/geometry_path_storage.h"
53
#include "ui_extend_image_view.h"
54
#include "gfx_utils/file.h"
Z
zhangguyuan 已提交
55
#include "gfx_utils/list.h"
56
#include "gfx_utils/diagram/common/paint.h"
57

M
mamingshuai 已提交
58
namespace OHOS {
59
class RenderBase;
M
mamingshuai 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

/**
 * @brief Defines a canvas, which is used to draw multiple types of 2D graphs.
 *
 * @since 1.0
 * @version 1.0
 */
class UICanvas : public UIView {
public:
    /**
     * @brief A constructor used to create a <b>UICanvas</b> instance.
     *
     * @since 1.0
     * @version 1.0
     */
75
    UICanvas() : startPoint_({0, 0}), vertices_(nullptr){}
M
mamingshuai 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

    /**
     * @brief A destructor used to delete the <b>UICanvas</b> instance.
     *
     * @since 1.0
     * @version 1.0
     */
    virtual ~UICanvas();

    /**
     * @brief Obtains the view type.
     *
     * @return Returns the view type. For details, see {@link UIViewType}.
     * @since 1.0
     * @version 1.0
     */
    UIViewType GetViewType() const override
    {
        return UI_CANVAS;
    }

    /**
     * @brief Clears the entire canvas.
     *
     * @since 1.0
     * @version 1.0
     */
    void Clear();

    /**
     * @brief Sets the coordinates of the start point for drawing a line. For example, if <b>startPoint</b> is
     *        set to {50, 50}, the line is drawn from this set of coordinates on the canvas.
     *
     * @param startPoint Indicates the coordinates of the start point.
     * @see GetStartPosition
     * @since 1.0
     * @version 1.0
     */
    void SetStartPosition(const Point& startPoint)
    {
        startPoint_ = startPoint;
    }

    /**
     * @brief Obtains the coordinates of the start point of a line.
     *
     * @return Returns the coordinates of the start point.
     * @see SetStartPosition
     * @since 1.0
     * @version 1.0
     */
    const Point& GetStartPosition() const
    {
        return startPoint_;
    }

    /**
     * @brief Draws a straight line.
     *
     * If {@link SetStartPosition} is not used to set the coordinates of the start point of the line, the drawing
     * starts from the end point of the last line.
     *
     * @param endPoint Indicates the end point of the straight line.
     * @param paint    Indicates the straight line style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawLine(const Point& endPoint, const Paint& paint);

    /**
     * @brief Draws a straight line from the coordinates of the start point.
     *
     * @param startPoint Indicates the coordinates of the start point.
     * @param endPoint   Indicates the coordinates of the end point.
     * @param paint      Indicates the straight line style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawLine(const Point& startPoint, const Point& endPoint, const Paint& paint);

    /**
     * @brief Draws a cubic Bezier curve.
     *
     * If {@link SetStartPosition} is not used to set the coordinates of the start point of the curve,
     * the drawing starts from the end point of the last line.
     * Currently, the opacity cannot be set, and the maximum line width is <b>3</b>.
     *
     * @param control1 Indicates the coordinates of the first control point of the cubic Bezier curve.
     * @param control2 Indicates the coordinates of the second control point of the cubic Bezier curve.
     * @param endPoint Indicates the coordinates of the end point of the cubic Bezier curve.
     * @param paint    Indicates the curve style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawCurve(const Point& control1, const Point& control2, const Point& endPoint, const Paint& paint);

    /**
     * @brief Draws a cubic Bezier curve from the start point coordinates.
     *
     * Currently, the opacity cannot be set, and the maximum line width is <b>3</b>.
     *
     * @param startPoint Indicates the coordinates of the start point of the cubic Bezier curve.
     * @param control1   Indicates the coordinates of the first control point of the cubic Bezier curve.
     * @param control2   Indicates the coordinates of the second control point of the cubic Bezier curve.
     * @param endPoint   Indicates the coordinates of the end point of the cubic Bezier curve.
     * @param paint      Indicates the curve style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawCurve(const Point& startPoint, const Point& control1, const Point& control2,
186
                   const Point& endPoint, const Paint& paint);
M
mamingshuai 已提交
187 188 189 190 191 192 193 194 195 196 197 198 199

    /**
     * @brief Draws a rectangle.
     *
     * @param startPoint Indicates the coordinates of the point at the upper left corner of the rectangle.
     * @param height     Indicates the height of the rectangle.
     * @param width      Indicates the width of the rectangle.
     * @param paint      Indicates the rectangle style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawRect(const Point& startPoint, int16_t height, int16_t width, const Paint& paint);

200 201 202 203 204 205 206 207 208
    /**
     * @brief Draws a rectangular path with no fill.
     * @param startPoint starting point
     * @param height
     * @param width
     * @param paint paint brush
     */
    void StrokeRect(const Point& startPoint, int16_t height, int16_t width, const Paint& paint);

209 210 211 212 213 214 215 216
    /**
     * @brief Clears pixels within a rectangle
     * @param startPoint starting point
     * @param height
     * @param width
     */
    void ClearRect(const Point& startPoint, int16_t height, int16_t width);

M
mamingshuai 已提交
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
    /**
     * @brief Draws a circle.
     *
     * @param center Indicates the coordinates of the circle center.
     * @param radius Indicates the radius of the circle.
     * @param paint  Indicates the circle style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawCircle(const Point& center, uint16_t radius, const Paint& paint);

    /**
     * @brief Draws a sector.
     *
     * When the start angle is smaller than the end angle, the sector is drawn clockwise.
     * Otherwise, the sector is drawn counterclockwise.
     *
     * @param center     Indicates the coordinates of the sector's center.
     * @param radius     Indicates the radius of the sector.
     * @param startAngle Indicates the start angle of the sector. Value <b>0</b> indicates the 12-o'clock direction,
     *                   and <b>90</b> indicates the 3-o'clock direction.
     * @param endAngle   Indicates the end angle of the sector. Value <b>0</b> indicates the 12-o'clock direction,
     *                   and <b>90</b> indicates the 3-o'clock direction.
     * @param paint      Indicates the sector style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawSector(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle, const Paint& paint);

    /**
     * @brief Draws an arc.
     *
     * Only stroke is supported. \n
     * When the start angle is smaller than the end angle, the sector is drawn clockwise.
     * Otherwise, the sector is drawn counterclockwise. \n
252
    *
M
mamingshuai 已提交
253 254 255 256 257 258 259 260 261 262 263 264
     * @param center     Indicates the coordinates of the arc's center.
     * @param radius     Indicates the radius of the arc.
     * @param startAngle Indicates the start angle of the arc. Value <b>0</b> indicates the 12-o'clock direction,
     *                   and <b>90</b> indicates the 3-o'clock direction.
     * @param endAngle   Indicates the end angle of the arc. Value <b>0</b> indicates the 12-o'clock direction,
     *                   and <b>90</b> indicates the 3-o'clock direction.
     * @param paint      Indicates the arc style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawArc(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle, const Paint& paint);

265
#if GRAPHIC_ENABLE_DRAW_IMAGE_FLAG
M
mamingshuai 已提交
266 267 268 269 270 271 272 273 274 275 276
    /**
     * @brief Draws an image.
     *
     * @param startPoint Indicates the coordinates of the start point.
     * @param image      Indicates the pointer to the image source.
     * @param paint      Indicates the image style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawImage(const Point& startPoint, const char* image, const Paint& paint);

277 278
    void DrawImage(const Point& startPoint, const char* image, const Paint& paint, int16_t width, int16_t height);
#endif
M
mamingshuai 已提交
279 280 281
    /**
     * @brief Defines the font style.
     */
282
    struct FontStyle : public HeapBase {
M
mamingshuai 已提交
283 284 285 286 287 288 289 290 291 292 293 294
        /** Text direction. For details, see {@link UITextLanguageDirect}. */
        UITextLanguageDirect direct;
        /** Text alignment mode. For details, see {@link UITextLanguageAlignment}. */
        UITextLanguageAlignment align;
        /** Font size */
        uint8_t fontSize;
        /** Letter-spacing */
        int16_t letterSpace;
        /** Font name */
        const char* fontName;
    };

295 296 297 298 299
    struct DrawCmd : public HeapBase {
        Paint paint;
        void* param;
        void (*DrawGraphics)(BufferInfo&, void*, const Paint&, const Rect&, const Rect&, const Style&);
        void (*DeleteParam)(void*);
300 301
    };

M
mamingshuai 已提交
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
    /**
     * @brief Draws text.
     *
     * Only fill is supported. \n
     * If the text length exceeds the value of <b>maxWidth</b>, the text will be truncated. \n
     *
     * @param startPoint Indicates the coordinates of the start point.
     * @param text       Indicates the pointer to the text content.
     * @param maxWidth   Indicates the maximum width of the text that can be displayed. If the maximum width is
     *                   exceeded, the text is truncated.
     * @param fontStyle  Indicates the text layout and font style. For details, see {@link FontStyle}.
     * @param paint      Indicates the text style. For details, see {@link Paint}.
     * @since 1.0
     * @version 1.0
     */
    void DrawLabel(const Point& startPoint, const char* text, uint16_t maxWidth, const FontStyle& fontStyle,
318
                   const Paint& paint);
M
mamingshuai 已提交
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353

    /**
     * @brief Creates a path.
     *
     * A round corner can be used to join two lines. Currently, miter and bevel joints are not supported.
     * To draw this path, you need to call {@link DrawPath}.
     *
     * @since 3.0
     * @version 5.0
     */
    void BeginPath();

    /**
     * @brief Moves the start point of this path to a specified point.
     *
     * @param point Indicates the specified point to move to.
     * @since 3.0
     * @version 5.0
     */
    void MoveTo(const Point& point);

    /**
     * @brief Creates a straight line from the end point of this path to a specified point.
     *
     * @param point Indicates the coordinates of the specified point.
     * @since 3.0
     * @version 5.0
     */
    void LineTo(const Point& point);

    /**
     * @brief Creates an arc path.
     *
     * @param center     Indicates the coordinates of the arc's center point.
     * @param radius     Indicates the radius of the arc.
354 355
     * @param startAngle Indicates the start angle of the arc.
     *                   The value <b>0</b> indicates the 12-o'clock direction,
M
mamingshuai 已提交
356
     *                   and <b>90</b> indicates the 3-o'clock direction.
357 358
     * @param endAngle   Indicates the end angle of the arc.
     *                   The value <b>0</b> indicates the 12-o'clock direction,
M
mamingshuai 已提交
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
     *                   and <b>90</b> indicates the 3-o'clock direction.
     * @since 3.0
     * @version 5.0
     */
    void ArcTo(const Point& center, uint16_t radius, int16_t startAngle, int16_t endAngle);

    /**
     * @brief Creates a rectangular path.
     *
     * @param point  Indicates the coordinates of the rectangle's upper left corner.
     * @param height Indicates the height of the rectangle.
     * @param width  Indicates the width of the rectangle.
     * @since 3.0
     * @version 5.0
     */
    void AddRect(const Point& point, int16_t height, int16_t width);

    /**
     * @brief Closes this path.
     *
     * @since 3.0
     * @version 5.0
     */
    void ClosePath();

    /**
     * @brief Draws this path.
     *
     * @param paint Indicates the path style. For details, see {@link Paint}.
     * @since 3.0
     * @version 5.0
     */
    void DrawPath(const Paint& paint);

393 394 395 396 397 398 399 400
    /**
     * @brief Fill polygon path
     * @param paint fill paint
     * @since 3.0
     * @version 5.0
     */
    void FillPath(const Paint& paint);

401 402 403 404 405 406 407 408 409 410
#if GRAPHIC_ENABLE_DRAW_TEXT_FLAG
    /*  Draw text on canvas */
    void StrokeText(const char* text, const Point& point, const FontStyle& fontStyle, const Paint& paint);
#endif

    /* Returns an object containing the specified text width */
    Point MeasureText(const char* text, const FontStyle& fontStyle);

    /* Save history status */
    void Save(Paint paint)
411
    {
412
        paintStack_.PushBack(paint);
413 414 415 416 417 418 419 420 421 422 423
    }

    /**
     * @brief Restore to last historical state
     * @return Returns the last paint value.
     * @since 3.0
     * @version 5.0
     */
    Paint Restore()
    {
        Paint paint;
424
        if (paintStack_.IsEmpty()) {
425 426
            return paint;
        }
427 428
        paint = paintStack_.Back();
        paintStack_.PopBack();
429 430 431
        return paint;
    }

432 433
    void OnBlendDraw(BufferInfo& gfxDstBuffer, const Rect& trunc);

N
niulihua 已提交
434
    void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override;
M
mamingshuai 已提交
435

436 437 438 439 440 441 442 443 444
    static void BlendRaster(const Paint& paint,
                        void* param,
                        RasterizerScanlineAntialias& blendRasterizer,
                        RasterizerScanlineAntialias& rasterizer,
                        RenderBase& renBase,
                        TransAffine& transform,
                        SpanBase& spanGen,
                        const Rect& rect,
                        bool isStroke);
M
mamingshuai 已提交
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
protected:
    constexpr static uint8_t MAX_CURVE_WIDTH = 3;

    struct LineParam : public HeapBase {
        Point start;
        Point end;
    };

    struct CurveParam : public HeapBase {
        Point start;
        Point control1;
        Point control2;
        Point end;
    };

    struct RectParam : public HeapBase {
        Point start;
        int16_t height;
        int16_t width;
    };

    struct CircleParam : public HeapBase {
        Point center;
        uint16_t radius;
    };

    struct ArcParam : public HeapBase {
        Point center;
        uint16_t radius;
        int16_t startAngle;
        int16_t endAngle;
    };

478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498
    struct TextParam : public HeapBase {
        const char* text;
        Point position;
        Color32 fontColor;
        uint8_t fontOpa;
        FontStyle fontStyle;
        Text* textComment;
        TextParam()
        {
            textComment = new Text;
        }

        ~TextParam()
        {
            if (textComment) {
                delete textComment;
                textComment = nullptr;
            }
        };
    };

M
mamingshuai 已提交
499
    Point startPoint_;
500
    UICanvasVertices* vertices_;
M
mamingshuai 已提交
501
    List<DrawCmd> drawCmdList_;
502
    // Save historical modification information of paint
503
    List<Paint> paintStack_;
504 505
    static BufferInfo* gfxMapBuffer_;

M
mamingshuai 已提交
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
    static void DeleteLineParam(void* param)
    {
        LineParam* lineParam = static_cast<LineParam*>(param);
        delete lineParam;
    }

    static void DeleteCurveParam(void* param)
    {
        CurveParam* curveParam = static_cast<CurveParam*>(param);
        delete curveParam;
    }

    static void DeleteRectParam(void* param)
    {
        RectParam* rectParam = static_cast<RectParam*>(param);
        delete rectParam;
    }

    static void DeleteCircleParam(void* param)
    {
        CircleParam* circleParam = static_cast<CircleParam*>(param);
        delete circleParam;
    }

    static void DeleteArcParam(void* param)
    {
        ArcParam* arcParam = static_cast<ArcParam*>(param);
        delete arcParam;
    }

    static void DeleteLabel(void* param)
    {
        UILabel* label = static_cast<UILabel*>(param);
        delete label;
    }

542 543 544 545 546 547 548 549 550 551 552 553
    static void DeleteImageView(void* param)
    {
        UIExtendImageView* imageView = static_cast<UIExtendImageView*>(param);
        delete imageView;
    }

    static void DeleteTextParam(void* param)
    {
        TextParam* textParam = static_cast<TextParam*>(param);
        delete textParam;
    }

N
niulihua 已提交
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
    static void DoDrawLine(BufferInfo& gfxDstBuffer,
                           void* param,
                           const Paint& paint,
                           const Rect& rect,
                           const Rect& invalidatedArea,
                           const Style& style);
    static void DoDrawCurve(BufferInfo& gfxDstBuffer,
                            void* param,
                            const Paint& paint,
                            const Rect& rect,
                            const Rect& invalidatedArea,
                            const Style& style);
    static void DoDrawRect(BufferInfo& gfxDstBuffer,
                           void* param,
                           const Paint& paint,
                           const Rect& rect,
                           const Rect& invalidatedArea,
                           const Style& style);
    static void DoFillRect(BufferInfo& gfxDstBuffer,
                           void* param,
                           const Paint& paint,
                           const Rect& rect,
                           const Rect& invalidatedArea,
                           const Style& style);
    static void DoDrawCircle(BufferInfo& gfxDstBuffer,
                             void* param,
                             const Paint& paint,
                             const Rect& rect,
                             const Rect& invalidatedArea,
                             const Style& style);
    static void DoDrawArc(BufferInfo& gfxDstBuffer,
                          void* param,
                          const Paint& paint,
                          const Rect& rect,
                          const Rect& invalidatedArea,
                          const Style& style);
590
#if GRAPHIC_ENABLE_DRAW_IMAGE_FLAG
N
niulihua 已提交
591 592 593 594 595 596
    static void DoDrawImage(BufferInfo& gfxDstBuffer,
                            void* param,
                            const Paint& paint,
                            const Rect& rect,
                            const Rect& invalidatedArea,
                            const Style& style);
597 598
#endif

N
niulihua 已提交
599 600 601 602 603 604 605 606 607 608 609 610
    static void DoDrawLabel(BufferInfo& gfxDstBuffer,
                            void* param,
                            const Paint& paint,
                            const Rect& rect,
                            const Rect& invalidatedArea,
                            const Style& style);
    static void DoDrawPath(BufferInfo& gfxDstBuffer,
                           void* param,
                           const Paint& paint,
                           const Rect& rect,
                           const Rect& invalidatedArea,
                           const Style& style);
M
mamingshuai 已提交
611
    static void GetAbsolutePosition(const Point& prePoint, const Rect& rect, const Style& style, Point& point);
N
niulihua 已提交
612 613 614 615
    static void DoDrawLineJoin(BufferInfo& gfxDstBuffer,
                               const Point& center,
                               const Rect& invalidatedArea,
                               const Paint& paint);
616 617 618 619 620 621 622 623

    static void DoFillPath(BufferInfo& gfxDstBuffer,
                           void* param,
                           const Paint& paint,
                           const Rect& rect,
                           const Rect& invalidatedArea,
                           const Style& style);

624 625 626 627 628 629 630
   static void  BlitMapBuffer(BufferInfo &gfxDstBuffer, BufferInfo& gfxMapBuffer,
                              Rect& textRect, TransformMap& transMap, const Rect& invalidatedArea);

#if GRAPHIC_ENABLE_DRAW_TEXT_FLAG
    static void DoDrawText(BufferInfo& gfxDstBuffer, void* param, const Paint& paint, const Rect& rect,
                           const Rect& invalidatedArea, const Style& style);
#endif
631 632 633 634 635 636 637
    /**
     * Assembly parameter setting lineweight,LineCap,LineJoin
     */
    template <class LineStyle>
    static void LineStyleCalc(DepictStroke<LineStyle>& strokeLineStyle, const Paint& paint)
    {
        strokeLineStyle.SetWidth(paint.GetStrokeWidth()); // Line style related
638 639 640 641 642 643 644 645 646
#if GRAPHIC_ENABLE_LINECAP_FLAG
        strokeLineStyle.SetLineCap(paint.GetLineCap());
#endif
#if GRAPHIC_ENABLE_LINEJOIN_FLAG
        strokeLineStyle.SetLineJoin(paint.GetLineJoin());
        if (paint.GetMiterLimit() > 0) {
            strokeLineStyle.SetMiterLimit(paint.GetMiterLimit());
        }
#endif
647 648 649 650 651 652 653 654 655 656 657 658 659 660
    };

    static bool IsSoild(const Paint& paint)
    {
        if (paint.GetStyle() == Paint::STROKE_STYLE ||
           paint.GetStyle() == Paint::FILL_STYLE ||
           paint.GetStyle() == Paint::STROKE_FILL_STYLE) {
            return true;
        }
        return false;
    }

    void DrawRectSetCmd(const Point& startPoint, int16_t height, int16_t width, const Paint& paint,
                        Paint::PaintStyle paintStyle);
661 662 663
    static void InitGfxMapBuffer(const BufferInfo& srcBuff, const Rect& rect);
    static BufferInfo* UpdateMapBufferInfo(const BufferInfo& srcBuff, const Rect& rect);
    static void DestroyMapBufferInfo();
M
mamingshuai 已提交
664 665 666
};
} // namespace OHOS
#endif // GRAPHIC_LITE_UI_CANVAS_H