Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSGGeometryNode.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 SkSGGeometryNode_DEFINED
9#define SkSGGeometryNode_DEFINED
10
12
13class SkCanvas;
14class SkPaint;
15class SkPath;
16struct SkPoint;
17
18namespace sksg {
19
20/**
21 * Base class for nodes which provide 'geometry' (as opposed to paint)
22 * for drawing.
23 *
24 * Think SkRect, SkPath, etc.
25 */
26class GeometryNode : public Node {
27public:
28 void clip(SkCanvas*, bool antiAlias) const;
29 void draw(SkCanvas*, const SkPaint&) const;
30
31 bool contains(const SkPoint&) const;
32
33 SkPath asPath() const;
34
35protected:
37
38 virtual void onClip(SkCanvas*, bool antiAlias) const = 0;
39
40 virtual void onDraw(SkCanvas*, const SkPaint&) const = 0;
41
42 virtual bool onContains(const SkPoint&) const = 0;
43
44 virtual SkPath onAsPath() const = 0;
45
46private:
47 friend class Draw; // wants to know the cached bounds.
48
49 using INHERITED = Node;
50};
51
52} // namespace sksg
53
54#endif // SkSGGeometryNode_DEFINED
bool contains(const SkPoint &) const
virtual void onClip(SkCanvas *, bool antiAlias) const =0
virtual SkPath onAsPath() const =0
virtual bool onContains(const SkPoint &) const =0
void clip(SkCanvas *, bool antiAlias) const
virtual void onDraw(SkCanvas *, const SkPaint &) const =0
void draw(SkCanvas *, const SkPaint &) const
Definition Skottie.h:32