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.
 
 
 
 
 
 

35 lines
1.2 KiB

/* Обёртка rlottie для TGS: распаковывает анимацию, хранит текущий кадр и рисует QImage.
* Воспроизведение координирует AnimTimer; объект освобождает свой animation handle. */
#pragma once
#include <QImage>
#include <QByteArray>
#include <QSize>
#include <cstdint>
class LottieIcon {
public:
explicit LottieIcon(const QByteArray &tgsData, const QString &key);
~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; }
int tgsSize() const { return m_tgsSize; }
void setTgsSize(int sz) { m_tgsSize = sz; }
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;
int m_tgsSize = 0;
double m_frameRate = 60.0;
size_t m_w = 0, m_h = 0;
QByteArray m_jsonData;
};