You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
842 B
30 lines
842 B
#pragma once |
|
|
|
#include <QImage> |
|
#include <QByteArray> |
|
#include <QSize> |
|
#include <cstdint> |
|
|
|
class LottieIcon { |
|
public: |
|
explicit LottieIcon(const QByteArray &tgsData); |
|
~LottieIcon(); |
|
|
|
bool isValid() const { return m_valid; } |
|
QSize originalSize() const { return QSize((int)m_w, (int)m_h); } |
|
int frameCount() const { return m_totalFrames; } |
|
double frameRate() const { return m_frameRate; } |
|
int currentFrame() const { return m_currentFrame; } |
|
|
|
QImage renderFrame(int frameNum, QSize targetSize) const; |
|
void advanceFrame() { m_currentFrame = (m_currentFrame + 1) % m_totalFrames; } |
|
|
|
private: |
|
bool m_valid = false; |
|
struct Lottie_Animation_S *m_anim = nullptr; |
|
int m_currentFrame = 0; |
|
int m_totalFrames = 0; |
|
double m_frameRate = 60.0; |
|
size_t m_w = 0, m_h = 0; |
|
QByteArray m_jsonData; |
|
};
|
|
|