lotplayer: improve header format.
[platform/core/uifw/lottie-player.git] / example / lottieview.h
1 #ifndef LOTTIEVIEW_H
2 #define LOTTIEVIEW_H
3
4 #ifndef EFL_BETA_API_SUPPORT
5 #define EFL_BETA_API_SUPPORT
6 #endif
7
8 #ifndef EFL_EO_API_SUPPORT
9 #define EFL_EO_API_SUPPORT
10 #endif
11
12 #include <Eo.h>
13 #include <Efl.h>
14 #include <Evas.h>
15 #include <Ecore.h>
16 #include <Ecore_Evas.h>
17 #include"lottieplayer.h"
18 #include<future>
19 class LottieView
20 {
21 public:
22     enum class RepeatMode {
23         Restart,
24         Reverse
25     };
26     LottieView(Evas *evas, bool renderMode = true, bool asyncRender = true);
27     ~LottieView();
28     void setSize(int w, int h);
29     void setPos(int x, int y);
30     void setFilePath(const char *filePath);
31     void show();
32     void hide();
33     void loop(bool loop);
34     void setSpeed(float speed) { mSpeed = speed;}
35     void setRepeatCount(int count);
36     void setRepeatMode(LottieView::RepeatMode mode);
37 public:
38     void seek(float pos);
39     void finished();
40     void play();
41     void pause();
42     void stop();
43     void render();
44 private:
45     void createVgNode(LOTNode *node, Efl_VG *parent);
46     void update(const std::vector<LOTNode *> &);
47     void restart();
48 public:
49     int                      mw;
50     int                      mh;
51     Evas                    *mEvas;
52     Efl_VG                  *mRoot;
53     Evas_Object             *mVg;
54     int                      mRepeatCount;
55     LottieView::RepeatMode   mRepeatMode;
56     lotplayer::LOTPlayer    *mPlayer;
57     Ecore_Animator          *mAnimator{nullptr};
58     bool                     mLoop;
59     int                      mCurCount;
60     bool                     mReverse;
61     bool                     mPalying;
62     Evas_Object             *mImage;
63     float                    mSpeed;
64     bool                     mRenderMode;
65     bool                     mAsyncRender;
66     bool                     mDirty;
67     float                    mPendingPos;
68     std::future<bool>        mRenderTask;
69     LOTBuffer                mBuffer;
70 };
71 #endif //LOTTIEVIEW_H