1 #ifndef _LOTTIE_ANIMATION_H_
2 #define _LOTTIE_ANIMATION_H_
11 #define LOT_EXPORT __declspec(dllexport)
16 #define LOT_EXPORT __declspec(dllimport)
21 #define LOT_EXPORT __attribute__((visibility("default")))
35 class LOT_EXPORT Surface {
38 Surface(uint32_t *buffer, size_t width, size_t height, size_t bytesPerLine);
39 size_t width() const {return mWidth;}
40 size_t height() const {return mHeight;}
41 size_t bytesPerLine() const {return mBytesPerLine;}
42 uint32_t *buffer() const {return mBuffer;}
51 class LOT_EXPORT Animation {
54 static std::unique_ptr<Animation>
55 loadFromFile(const std::string &path);
57 static std::unique_ptr<Animation>
58 loadFromData(const char *jsonData, const char *key);
60 double frameRate() const;
61 size_t totalFrame() const;
62 void size(size_t &width, size_t &height) const;
63 double duration() const;
64 size_t frameAtPos(double pos);
66 std::future<Surface> render(size_t frameNo, Surface surface);
67 void renderSync(size_t frameNo, Surface surface);
72 const std::vector<LOTNode *> &renderList(size_t frameNo, size_t width, size_t height) const;
74 std::unique_ptr<AnimationImpl> d;
76 } // namespace lotplayer
78 #endif // _LOTTIE_ANIMATION_H_