summaryrefslogtreecommitdiffstats
path: root/lisiblepng/src/lisiblepng.h
diff options
context:
space:
mode:
authorClement Sibille <clements+git@lisible.xyz>2024-03-05 20:43:33 +0900
committerClement Sibille <clements+git@lisible.xyz>2024-03-05 20:43:33 +0900
commit1769d0007b79ce5a054a22d39409dab22f2889b2 (patch)
tree528810198e69d0bf132a591b3d51bd078db8739d /lisiblepng/src/lisiblepng.h
parent7d5613f1e16430fcfc8ddb843be9435e10879bc0 (diff)
Add accessor methods for PNG data
Diffstat (limited to 'lisiblepng/src/lisiblepng.h')
-rw-r--r--lisiblepng/src/lisiblepng.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/lisiblepng/src/lisiblepng.h b/lisiblepng/src/lisiblepng.h
index 86a8364..a23ac91 100644
--- a/lisiblepng/src/lisiblepng.h
+++ b/lisiblepng/src/lisiblepng.h
@@ -1,10 +1,21 @@
#ifndef LISIBLE_PNG_H
#define LISIBLE_PNG_H
+#include <stdint.h>
#include <stdio.h>
-struct Png;
-typedef struct Png Png;
+typedef enum {
+ LisPngColourType_Greyscale = 0,
+ LisPngColourType_Truecolour = 2,
+ LisPngColourType_IndexedColour = 3,
+ LisPngColourType_GreyscaleWithAlpha = 4,
+ LisPngColourType_TruecolourWithAlpha = 6,
+ LisPngColourType_Unknown
+} LisPngColourType;
+uint8_t LisPngColourType_sample_count(const LisPngColourType colour_type);
+
+struct LisPng;
+typedef struct LisPng LisPng;
/// Parses the provided PNG stream
///
@@ -12,12 +23,17 @@ typedef struct Png Png;
/// @returns The parsed PNG as a Png struct pointer or NULL if an error occured.
/// The returned PNG is owned by the caller and must be destroyed with
/// Png_destroy.
-Png *lis_Png_decode(FILE *stream);
+LisPng *LisPng_decode(FILE *stream);
/// Outputs the provided Png struct as a PPM image to stdout
///
/// @param png The png
-void lis_Png_dump_ppm(const Png *png);
+void LisPng_dump_ppm(const LisPng *png);
+LisPngColourType LisPng_colour_type(const LisPng *png);
+uint8_t LisPng_bits_per_sample(const LisPng *png);
+uint8_t *LisPng_data_ptr(const LisPng *png);
+uint32_t LisPng_width(const LisPng *png);
+uint32_t LisPng_height(const LisPng *png);
/// Destroys a Png instance
-void lis_Png_destroy(Png *png);
+void LisPng_destroy(LisPng *png);
#endif // LISIBLE_PNG_H
Go back to lisible.xyz