xref: /aosp_15_r20/external/skia/modules/svg/include/SkSVGPath.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkSVGPath_DEFINED
9 #define SkSVGPath_DEFINED
10 
11 #include "include/core/SkPath.h"
12 #include "include/core/SkRect.h"
13 #include "include/core/SkRefCnt.h"
14 #include "include/private/base/SkAPI.h"
15 #include "modules/svg/include/SkSVGNode.h"
16 #include "modules/svg/include/SkSVGShape.h"
17 
18 class SkCanvas;
19 class SkPaint;
20 class SkSVGLengthContext;
21 class SkSVGRenderContext;
22 enum class SkPathFillType;
23 
24 class SK_API SkSVGPath final : public SkSVGShape {
25 public:
Make()26     static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); }
27 
28     SVG_ATTR(Path, SkPath, SkPath())
29 
30 protected:
31     bool parseAndSetAttribute(const char*, const char*) override;
32 
33     void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
34                 SkPathFillType) const override;
35 
36     SkPath onAsPath(const SkSVGRenderContext&) const override;
37 
38     SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override;
39 
40 private:
41     SkSVGPath();
42 
43     using INHERITED = SkSVGShape;
44 };
45 
46 #endif // SkSVGPath_DEFINED
47