7d247def34f09ef10105ff5b6ffa1f029c35ac4d
[platform/core/uifw/lottie-player.git] / src / vector / vdasher.h
1 #ifndef VDASHER_H
2 #define VDASHER_H
3 #include "vpath.h"
4
5 V_BEGIN_NAMESPACE
6
7 class VDasher {
8 public:
9     VDasher(const float *dashArray, int size);
10     VPath dashed(const VPath &path);
11
12 private:
13     void moveTo(const VPointF &p);
14     void lineTo(const VPointF &p);
15     void cubicTo(const VPointF &cp1, const VPointF &cp2, const VPointF &e);
16     void close();
17     void addLine(const VPointF &p);
18     void addCubic(const VPointF &cp1, const VPointF &cp2, const VPointF &e);
19     void updateActiveSegment();
20
21 private:
22     struct Dash {
23         float length;
24         float gap;
25     };
26     const VDasher::Dash *mDashArray;
27     int                  mArraySize;
28     VPointF              mStartPt;
29     VPointF              mCurPt;
30     int                  mCurrentDashIndex;
31     float                mCurrentDashLength;
32     bool                 mIsCurrentOperationGap;
33     float                mDashOffset;
34     VPath                mDashedPath;
35     bool                 mNewSegment=false;
36 };
37
38 V_END_NAMESPACE
39
40 #endif  // VDASHER_H