doga.h
doga, the engine's own GIF decoder. It works on its own, with no device.
#include "doga/doga.h". The guide starts at GIF and animations.
Decoder
Explained in GIF and animations.
doga::statusdoga::disposedoga::rectdoga::framedoga::infodoga::limitsdoga::limits_defaultdoga::probedoga::filedoga::opendoga::closedoga::info_ofdoga::frame_atdoga::bytes_ofdoga::status_textdoga::renderdoga::forgetdoga::showndoga::job_fndoga::run_fndoga::sink_fndoga::render_allExample
gif_length.cpp
#include "doga/doga.h"
#include <stdlib.h>
// every frame of a gif into one canvas, straight rgba, no engine needed
static uint32_t total_ms(const uint8_t* bytes, size_t n)
{
doga::limits l = doga::limits_default();
doga::info inf;
doga::status why;
doga::file* f = doga::open(bytes, n, &l, &inf, &why);
if (!f) {
return 0u;
}
const uint32_t stride = inf.width * 4u;
uint8_t* canvas = static_cast<uint8_t*>(calloc(size_t(stride) * inf.height, 1u));
uint32_t ms = 0u;
for (uint32_t i = 0; canvas && i < inf.frames; ++i) {
doga::rect dirty;
if (doga::render(f, i, canvas, stride, &dirty)) {
ms += doga::frame_at(f, i)->delay_ms;
}
}
free(canvas);
doga::close(f);
return ms;
}