From 76107d44f5e30edfd3b89a0363cd00d117dccd4f Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Wed, 15 Apr 2026 17:34:02 +1000 Subject: feat(png): Implement genericness for PNG --- include/tinyff/image/png.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'include/tinyff') diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h index 5119fb1..b52845a 100644 --- a/include/tinyff/image/png.h +++ b/include/tinyff/image/png.h @@ -2,10 +2,8 @@ #define PNG_H #include -#include #include #include -#include #include #include @@ -22,8 +20,8 @@ static const unsigned char PNG_SIGNATURE[8] = { typedef enum { FF_PNG_MODE_NONE = 0, - FF_PNG_MODE_DIRECT_COLOR, // pixels - FF_PNG_MODE_PALETTE // palette + FF_PNG_MODE_DIRECT_COLOR = 1, // pixels + FF_PNG_MODE_PALETTE = -1 // palette } ff_png_mode; typedef struct { @@ -58,10 +56,6 @@ typedef struct { } ff_png_ctx; -// Small BpP helper function - -static inline uint16_t ff_png_bpp(ff_png_ctx *ctx); - typedef ff_result (*ff_png_chunk_handler_ptr)(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); @@ -92,6 +86,6 @@ ff_result ff_png_isvalid(ff_ctx* ctx, ff_stream *stream); ff_result ff_open_png(ff_ctx* ctx, ff_stream *stream, ff_png_ctx **out_ctx, ff_flag require_valid); ff_result ff_close_png(ff_ctx* ctx, ff_png_ctx *png_ctx); -ff_result ff_png_normalize(ff_ctx* ctx, ff_png_ctx *png_ctx, ff_image_ctx **out_data); +ff_result ff_png_normalize(ff_ctx* ctx, ff_png_ctx *png_ctx, ff_image_ctx **out_data, ff_flag consume); #endif -- cgit v1.2.3