From fd05629fb093dab6ae44db4f201a48f65c717288 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Wed, 4 Feb 2026 16:06:22 +1100 Subject: feat(png): Add ff_png_normalize function and generic image header --- include/tinyff/image/generic.h | 30 ++++++++++++++++++++++++++++++ include/tinyff/image/png.h | 3 +++ 2 files changed, 33 insertions(+) create mode 100644 include/tinyff/image/generic.h (limited to 'include/tinyff') diff --git a/include/tinyff/image/generic.h b/include/tinyff/image/generic.h new file mode 100644 index 0000000..e136027 --- /dev/null +++ b/include/tinyff/image/generic.h @@ -0,0 +1,30 @@ +// This is the generics image header file for tinyff +// It contains generic image structures and definitions + +#include "common.h" +#include "result.h" + +#ifndef GENERIC_IMAGE_H +#define GENERIC_IMAGE_H + + +// The image origin is **not** the origin point of the image +// But rather from what the image was loaded + +typedef enum { + FF_IMAGE_ORIGIN_PNG, +} ff_image_origin; + +// Only the basic information about an image +// Warning: Data is RGBA8888 using scanlines going from top to bottom +typedef struct { + uint32_t width; + uint32_t height; + ff_image_origin origin; + + uint8_t* data; + +} ff_image_ctx; + + +#endif \ No newline at end of file diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h index fd8d29d..0b0bb3b 100644 --- a/include/tinyff/image/png.h +++ b/include/tinyff/image/png.h @@ -10,6 +10,7 @@ #include "tinyff/result.h" #include "tinyff/common.h" #include "tinyff/stream.h" +#include "tinyff/image/generic.h" // External #include "ext/tinf.h" @@ -100,4 +101,6 @@ const ff_png_chunk_handler ff_png_chunk_handlers[] = { ff_result ff_png_isvalid(ff_stream *stream); ff_result ff_open_png(ff_stream *stream, ff_png_ctx **out_ctx); +ff_result ff_png_normalize(ff_png_ctx *ctx, ff_image_ctx **out_data); + #endif -- cgit v1.2.3