15 *error_message =
"Failed to allocate GIF decoder";
34 *error_message =
"Empty GIF data";
40 if (data.
size() < 13) {
42 *error_message =
"GIF data too small";
48 if (data[0] !=
'G' || data[1] !=
'I' || data[2] !=
'F') {
50 *error_message =
"Invalid GIF signature";
56 if (!((data[3] ==
'8' && data[4] ==
'7' && data[5] ==
'a') ||
57 (data[3] ==
'8' && data[4] ==
'9' && data[5] ==
'a'))) {
59 *error_message =
"Unsupported GIF version";
67 fl::u16
width = data[6] | (data[7] << 8);
68 fl::u16
height = data[8] | (data[9] << 8);
72 *error_message =
"Invalid GIF dimensions";
83 if (decoder->begin(stream)) {
85 info.
width = decoder->getWidth();
86 info.
height = decoder->getHeight();
static GifInfo parseGifInfo(fl::span< const fl::u8 > data, fl::string *error_message=nullptr)
static IDecoderPtr createDecoder(const GifConfig &config, fl::string *error_message=nullptr)
static bool isSupported()
constexpr bool empty() const FL_NOEXCEPT
constexpr fl::size size() const FL_NOEXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Base definition for an LED controller.