summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-10 19:26:50 +1100
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-10 19:26:50 +1100
commit072ee2558ac6c057626df58dc3a34c17546cd1a8 (patch)
tree19c3b89a7debac4aa44b12e536ed7f23f86b6656
parent886d280ce1c50d5e9112dd69305dcab96bcce9f1 (diff)
feat(bmp): Add section size definitions and macro for color table
-rw-r--r--include/tinyff/image/bmp.h5
-rw-r--r--src/format/image/bmp.c6
2 files changed, 11 insertions, 0 deletions
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 <tinyff/stream.h>
#include <tinyff/image/generic.h>
+#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