synfig-core  1.0.3
widthpoint.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
22 /* ========================================================================= */
23 
24 /* === S T A R T =========================================================== */
25 
26 #ifndef __SYNFIG_WIDTHPOINT_H
27 #define __SYNFIG_WIDTHPOINT_H
28 
29 /* === H E A D E R S ======================================================= */
30 
31 #include "uniqueid.h"
32 #include "real.h"
33 #include "vector.h"
34 
35 /* === M A C R O S ========================================================= */
36 
37 /* === T Y P E D E F S ===================================================== */
38 
39 /* === C L A S S E S & S T R U C T S ======================================= */
40 
41 namespace synfig {
42 
43 class WidthPoint : public UniqueID
44 {
45 private:
46  Real position_;
47  Real width_;
48  int side_type_[2]; // Before [0] and After[1] side types
49  bool dash_; // if true, widthpoint is used for dashed outlines
50  Real lower_bound_; // The lower boundary of the withpoint position
51  Real upper_bound_; // The upper boundary of the withpoint position
52 
53 public:
54 
55  enum SideType
56  {
62  };
63 
64  WidthPoint();
65  WidthPoint(Real position, Real width, int sidebefore=TYPE_INTERPOLATE,
66  int sideafter=TYPE_INTERPOLATE, bool dash_=false);
67 
68  const Real& get_position()const;
69  void set_position(const Real& x);
70  // gets the normalised position: converts it to be inside [0,1]
71  Real get_norm_position(bool wplistloop)const;
72  // gets the postion inside the lower and upper boundaries
73  Real get_bound_position(bool wplistloop)const;
74  // changes the widthpoint's position to be inside [0,1)
75  void normalize(bool loop);
76  // reverse its position inside boundaries
77  void reverse();
78 
79  const Real& get_width()const;
80  void set_width(Real x);
81 
82  int get_side_type_before()const;
83  void set_side_type_before(int sidebefore);
84  int get_side_type_after()const;
85  void set_side_type_after(int sideafter);
86  int get_side_type(int i)const;
87  bool get_dash()const;
88  void set_dash(bool l);
89  Real get_lower_bound()const;
90  void set_lower_bound(Real lb);
91  Real get_upper_bound()const;
92  void set_upper_bound(Real ub);
93  bool operator < (const WidthPoint& rhs);
94  bool operator == (const WidthPoint& rhs);
95 
96 }; // END of class WidthPoint
97 
98 }; // END of namespace synfig
99 
100 /* === E N D =============================================================== */
101 
102 #endif