From 072ee2558ac6c057626df58dc3a34c17546cd1a8 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Tue, 10 Mar 2026 19:26:50 +1100 Subject: feat(bmp): Add section size definitions and macro for color table --- include/tinyff/image/bmp.h | 5 +++++ src/format/image/bmp.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/include/tinyff/image/bmp.h b/include/tinyff/image/bmp.h index 1cf9f31..80aaa4d 100644 --- a/include/tinyff/image/bmp.h +++ b/include/tinyff/image/bmp.h @@ -11,6 +11,11 @@ #include #include +#define FF_BMP_HEADER_SIZE 14 +#define FF_BMP_INFO_SIZE 40 +#define FF_BMP_COLOR_TABLE_SIZE(bpp, clrused) \ + ((bpp) <= 8 ? (4 * ((clrused) ? (clrused) : (1u << (bpp)))) : 0) + static const unsigned char BMP_SIGNATURE[2] = { 'B', 'M' }; diff --git a/src/format/image/bmp.c b/src/format/image/bmp.c index 7dfaa76..4a0ca95 100644 --- a/src/format/image/bmp.c +++ b/src/format/image/bmp.c @@ -61,4 +61,10 @@ ff_result ff_open_bmp(ff_stream *stream, ff_bmp_ctx **out_ctx, ff_flag require_v ff_dprintf("bmp: open_bmp reached WIP end\n"); return FF_RESULT_WARN_NO_IMPL; +} + +ff_result ff_bmp_header_handler(uint8_t *buf, size_t len, ff_bmp_ctx *ctx) { + if (len != 14) { + + } } \ No newline at end of file -- cgit v1.2.3