ASPiK SDK
clinestyle.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __clinestyle__
6 #define __clinestyle__
7 
8 #include "vstguifwd.h"
9 #include <vector>
10 
11 namespace VSTGUI {
12 
13 //-----------
14 // @brief Line Style
15 //-----------
17 {
18 public:
19  using CoordVector = std::vector<CCoord>;
20 
21  enum LineCap
22  {
23  kLineCapButt = 0,
24  kLineCapRound,
25  kLineCapSquare
26  };
27 
28  enum LineJoin
29  {
30  kLineJoinMiter = 0,
31  kLineJoinRound,
32  kLineJoinBevel
33  };
34 
35  CLineStyle () = default;
36  explicit CLineStyle (LineCap cap, LineJoin join = kLineJoinMiter, CCoord dashPhase = 0., uint32_t dashCount = 0, const CCoord* dashLengths = nullptr);
37  CLineStyle (LineCap cap, LineJoin join, CCoord dashPhase, const CoordVector& dashLengths);
38  CLineStyle (const CLineStyle& lineStyle);
39  ~CLineStyle () noexcept = default;
40 
41  CLineStyle (LineCap cap, LineJoin join, CCoord dashPhase, CoordVector&& dashLengths) noexcept;
42  CLineStyle (CLineStyle&& cls) noexcept;
43  CLineStyle& operator= (CLineStyle&& cls) noexcept;
44 
45  LineCap getLineCap () const { return cap; }
46  LineJoin getLineJoin () const { return join; }
47  CCoord getDashPhase () const { return dashPhase; }
48  uint32_t getDashCount () const { return static_cast<uint32_t> (dashLengths.size ()); }
49  CoordVector& getDashLengths () { return dashLengths; }
50  const CoordVector& getDashLengths() const { return dashLengths; }
51 
52  void setLineCap (LineCap newCap) { cap = newCap; }
53  void setLineJoin (LineJoin newJoin) { join = newJoin; }
54  void setDashPhase (CCoord phase) { dashPhase = phase; }
55 
56  bool operator== (const CLineStyle& cls) const;
57  bool operator!= (const CLineStyle& cls) const { return !(*this == cls); }
58  CLineStyle& operator= (const CLineStyle& cls);
59 
60 protected:
61  LineCap cap {kLineCapButt};
62  LineJoin join {kLineJoinMiter};
63  CCoord dashPhase {0.};
64  CoordVector dashLengths;
65 };
66 
67 extern const CLineStyle kLineSolid;
68 extern const CLineStyle kLineOnOffDash;
69 
70 }
71 
72 #endif // __clinestyle__
Definition: clinestyle.h:16
Definition: customcontrols.cpp:8