Element.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/math/Vector2D.hpp>
10 
11 namespace esvg {
12  namespace render {
13  enum path {
14  path_stop,
15  path_close,
16  path_moveTo,
17  path_lineTo,
18  path_lineToH,
19  path_lineToV,
20  path_curveTo,
21  path_smoothCurveTo,
22  path_bezierCurveTo,
23  path_bezierSmoothCurveTo,
24  path_elliptic
25  };
26  class Element {
27  public:
28  Element(enum path _type, bool _relative=false) :
29  m_cmd(_type),
30  m_relative(_relative) {
31 
32  }
33  virtual ~Element() { }
34  private:
35  enum path m_cmd;
36  public:
37  enum path getType() const {
38  return m_cmd;
39  }
40  protected:
41  bool m_relative;
42  public:
43  bool getRelative() const {
44  return m_relative;
45  }
46  void setRelative(bool _relative) {
47  m_relative = _relative;
48  }
49  protected:
50  vec2 m_pos;
51  public:
52  const vec2& getPos() const {
53  return m_pos;
54  }
55  void setPos(const vec2& _val) {
56  m_pos = _val;
57  }
58  protected:
59  vec2 m_pos1;
60  public:
61  const vec2& getPos1() const {
62  return m_pos1;
63  }
64  void setPos1(const vec2& _val) {
65  m_pos1 = _val;
66  }
67  protected:
68  vec2 m_pos2;
69  public:
70  const vec2& getPos2() const {
71  return m_pos2;
72  }
73  void setPos2(const vec2& _val) {
74  m_pos2 = _val;
75  }
76  public:
77  virtual std::string display() const = 0;
78  };
79  }
83  std::ostream& operator <<(std::ostream& _os, const esvg::render::Element& _obj);
87  std::ostream& operator <<(std::ostream& _os, enum esvg::render::path _obj);
88 }
89 
101 
Main esvg namespace.
Definition: Base.hpp:24
Definition: Element.hpp:26