sf-svg
Shape.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 SHAPE_HPP
13 #define SHAPE_HPP
14 
15 #include <string>
16 #include <vector>
17 
18 #include "Path.hpp"
19 #include "nanosvg.hpp"
20 
21 namespace nsvg {
25  class Shape {
26  const cstyle::ShapeStruct* internal;
27 
28  public:
34  Shape(const cstyle::ShapeStruct *ptr);
35 
39  std::string getId() const;
40 
44  cstyle::Paint getFill() const;
45 
49  cstyle::Paint getStroke() const;
50 
54  float getOpacity() const;
55 
59  float getStrokeWidth() const;
60 
64  float getStrokeDashOffset() const;
65 
69  const float* getStrokeDashArray() const;
70 
74  size_t getStrokeDashCount() const;
75 
79  LineJoin getStrokeLineJoin() const;
80 
84  LineCap getStrokeLineCap() const;
85 
89  Flags getFlags() const;
90 
94  const float* getBounds() const;
95 
99  PathVector getPaths() const;
100 
104  Shape getNextShape() const;
105 
109  bool good() const;
110 
119  Shape& operator ++();
120 
124  operator bool() const;
125  };
126 
131  : public std::vector<Shape> {
132  public:
137  while(shape_ptr) {
138  emplace_back(shape_ptr);
139  shape_ptr = shape_ptr->next;
140  }
141  }
142  };
143 }
144 
145 #endif // SHAPE_HPP
float getStrokeWidth() const
Get stroke width.
Definition: Shape.cpp:35
cstyle::Paint getStroke() const
Get stroke.
Definition: Shape.cpp:27
Vector of shapes.
Definition: Shape.hpp:130
Flags getFlags() const
get Flags
Definition: Shape.cpp:59
LineCap getStrokeLineCap() const
Get stroke line cap.
Definition: Shape.cpp:55
size_t getStrokeDashCount() const
Get stroke dash count.
Definition: Shape.cpp:47
std::string getId() const
Get ID.
Definition: Shape.cpp:19
Shape(const cstyle::ShapeStruct *ptr)
Constructor.
Definition: Shape.cpp:15
C++-styled cstyle::ShapeStruct wrapper.
Definition: Shape.hpp:25
Path class declaration.
Shape & operator++()
Switches itself to next shape.
Definition: Shape.cpp:79
Nanosvg++ namespace.
Definition: enums.hpp:15
Shape getNextShape() const
Get next shape.
Definition: Shape.cpp:71
PathVector getPaths() const
Get paths.
Definition: Shape.cpp:67
bool good() const
Is ok?
Definition: Shape.cpp:75
float getStrokeDashOffset() const
Get stroke dash offset.
Definition: Shape.cpp:39
cstyle::Paint getFill() const
Get fill paint.
Definition: Shape.cpp:23
Nanosvg++ declarations.
const float * getStrokeDashArray() const
Get stroke dash array.
Definition: Shape.cpp:43
const float * getBounds() const
Get bounds.
Definition: Shape.cpp:63
LineJoin getStrokeLineJoin() const
Get stroke line join.
Definition: Shape.cpp:51
Definition: nanosvg.hpp:84
float getOpacity() const
Get opacity.
Definition: Shape.cpp:31
Definition: nanosvg.hpp:102
Vector of paths.
Definition: Path.hpp:100
ShapeVector(cstyle::ShapeStruct *shape_ptr)
Constructor.
Definition: Shape.hpp:136