sf-svg
Path.hpp
Go to the documentation of this file.
1 /* ====================================================== *
2  * nanosvg++ *
3  * This software is a fork of nanosvg (nanosvgrastr.hpp). *
4  * No license-related aspects are affected. *
5  * Kamil Koczurek | koczurekk@gmail.com *
6  * ====================================================== */
11 
12 #ifndef PATH_HPP
13 #define PATH_HPP
14 
15 #include <SFML/System/Vector2.hpp>
16 #include <vector>
17 
18 #include "nanosvg.hpp"
19 
20 namespace nsvg {
24  struct CubicPointSet {
27  sf::Vector2f begin;
28 
31  sf::Vector2f end;
32 
35  sf::Vector2f control1;
36 
39  sf::Vector2f control2;
40  };
41 
45  class Path {
46  public:
47  const cstyle::PathStruct* internal;
48 
49  public:
55  Path(const cstyle::PathStruct* ptr);
56 
69  std::vector<CubicPointSet> getPointsSets() const;
70 
74  Path getNextPath() const;
75 
79  bool good() const;
80 
89  Path& operator ++();
90 
94  operator bool() const;
95  };
96 
101  : public std::vector<Path> {
102  public:
107  while(path_ptr) {
108  emplace_back(path_ptr);
109  path_ptr = path_ptr->next;
110  }
111  }
112  };
113 }
114 
115 #endif // PATH_HPP
Point set of Bezier Cubic Curve.
Definition: Path.hpp:24
sf::Vector2f control2
Second handle of the curve.
Definition: Path.hpp:39
sf::Vector2f control1
First handle of the curve.
Definition: Path.hpp:35
PathVector(cstyle::PathStruct *path_ptr)
Constructor.
Definition: Path.hpp:106
Nanosvg++ namespace.
Definition: enums.hpp:15
sf::Vector2f end
End of the curve.
Definition: Path.hpp:31
sf::Vector2f begin
Beginning of the curve.
Definition: Path.hpp:27
Nanosvg++ declarations.
Definition: nanosvg.hpp:92
C++-styled cstyle::PathStruct wrapper.
Definition: Path.hpp:45
Vector of paths.
Definition: Path.hpp:100