2 using namespace rlottie;
4 std::unique_ptr<Animation> anim;
8 uint32_t curColor = UINT32_MAX;
10 void initAnimation(size_t w, size_t h)
14 bytesPerLine = width * sizeof(uint32_t);
15 buffer = (uint32_t*)calloc(bytesPerLine * height, sizeof(uint32_t));
18 void setAnimation(char* path, size_t w, size_t h)
20 anim = Animation::loadFromFile(path);
23 uint32_t* renderRLottieAnimation(uint32_t frameNum)
25 static Surface surface = Surface(buffer, width, height, bytesPerLine);
26 anim->renderSync(frameNum, surface);
28 for (int i = 0; i < height; i++)
29 for (int j = 0; j < width; ++j)
31 uint32_t* v = buffer + i * width + j;
32 if (*v == 0) *v = curColor;
37 void setAnimationColor(int r, int g, int b)
39 curColor = ((255 << 16) * r) + ((255 << 8) * g) + 255 * b;
42 size_t getTotalFrame()
44 return anim->totalFrame();