From dd5fb05fb732a294727bc595839b274137a7ca06 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Mon, 2 Mar 2026 19:32:49 +1100 Subject: feat(bmp): Make ff_bmp_section_handler lookup table --- include/tinyff/image/bmp.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/tinyff/image/bmp.h b/include/tinyff/image/bmp.h index bfafcdc..dbc7b3e 100644 --- a/include/tinyff/image/bmp.h +++ b/include/tinyff/image/bmp.h @@ -44,6 +44,27 @@ typedef struct { typedef ff_result (*ff_bmp_section_handler_ptr)(uint8_t *buf, size_t len, ff_bmp_ctx* ctx); +typedef struct { + // Even though the types in bitmaps are invisible (they don't have labels) + // I'll just keep them in for the sake of being in + // And I might just handle the section looping a bit differently + // And their names will be what I saw in the spec + + const char* type; + ff_bmp_section_handler_ptr handler; +} ff_bmp_section_handler; + +const ff_bmp_section_handler ff_png_chunk_handlers[] = { + // TODO: Make handlers + + {"Header", NULL}, + {"InfoHeader", NULL}, + {"ColorTable", NULL}, + {"RasterData", NULL}, + + {NULL, NULL} // Terminator +}; + ff_result ff_bmp_isvalid(ff_stream *stream); ff_result ff_open_bmp(ff_stream *stream, ff_bmp_ctx **out_ctx, ff_flag require_valid); -- cgit v1.2.3