Swiftray  1.0
path-shape.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <shape/shape.h>
4 
5 using namespace std;
6 
7 class PathShape : public Shape {
8 public:
9  enum class NodeType {
10  CurveSymmetry,
11  CurveSmooth,
12  CurveCorner,
13  CurveCtrlPrev,
14  CurveCtrlNext,
15  LINE_TO,
16  MOVE_TO
17  };
18 
19  PathShape() noexcept;
20 
21  PathShape(QPainterPath path);
22 
23  virtual ~PathShape();
24 
25  ShapePtr clone() const override;
26 
27  bool hitTest(QPointF global_coord, qreal tolerance) const override;
28 
29  bool hitTest(QRectF global_coord_rect) const override;
30 
31  void paint(QPainter *painter) const override;
32 
33  Shape::Type type() const override;
34 
35  const QPainterPath &path() const;
36 
37  void setPath(const QPainterPath &path);
38 
39  bool isFilled() const;
40 
41  void setFilled(bool filled);
42 
43  friend class DocumentSerializer;
44 
45 private:
46  void calcBoundingBox() const override;
47 
48  bool filled_;
49  mutable QRectF hit_test_rect_;
50 
51 protected:
52  QPainterPath path_;
53 };
Save and load documents as binary format.
Definition: document-serializer.h:18
Definition: path-shape.h:7
NodeType
Definition: path-shape.h:9
A base class for shape objects that contains transform and parent information.
Definition: shape.h:17
shared_ptr< Shape > ShapePtr
Definition: shape.h:137