Skia
2D Graphics Library
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 
13 class SkCanvas;
14 class SkPaint;
15 class SkPath;
16 
17 namespace sksg {
18 
25 class GeometryNode : public Node {
26 public:
27  void clip(SkCanvas*, bool antiAlias) const;
28  void draw(SkCanvas*, const SkPaint&) const;
29 
30  bool contains(const SkPoint&) const;
31 
32  SkPath asPath() const;
33 
34 protected:
36 
37  virtual void onClip(SkCanvas*, bool antiAlias) const = 0;
38 
39  virtual void onDraw(SkCanvas*, const SkPaint&) const = 0;
40 
41  virtual bool onContains(const SkPoint&) const = 0;
42 
43  virtual SkPath onAsPath() const = 0;
44 
45 private:
46  friend class Draw; // wants to know the cached bounds.
47 
48  using INHERITED = Node;
49 };
50 
51 } // namespace sksg
52 
53 #endif // SkSGGeometryNode_DEFINED
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
SkPath contain geometry.
Definition: SkPath.h:58
Concrete rendering node.
Definition: SkSGDraw.h:24
Base class for nodes which provide 'geometry' (as opposed to paint) for drawing.
Definition: SkSGGeometryNode.h:25
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
SkPath asPath() const
void clip(SkCanvas *, bool antiAlias) const
virtual void onDraw(SkCanvas *, const SkPaint &) const =0
void draw(SkCanvas *, const SkPaint &) const
Base class for all scene graph nodes.
Definition: SkSGNode.h:32
Node(uint32_t invalTraits)
Definition: Skottie.h:30