From 22db7ab4cb3b2928095bd9775fb015a5e28487f6 Mon Sep 17 00:00:00 2001
From: Christian C <cc@localhost>
Date: Wed, 5 Mar 2025 21:57:20 -0800
Subject: Save to PNG

---
 include/lib/png.h      | 22 ++++++++++++++++++++++
 include/lib/seg/util.h |  3 +++
 2 files changed, 25 insertions(+)
 create mode 100644 include/lib/png.h

(limited to 'include')

diff --git a/include/lib/png.h b/include/lib/png.h
new file mode 100644
index 0000000..e7943c2
--- /dev/null
+++ b/include/lib/png.h
@@ -0,0 +1,22 @@
+#ifndef INC_LIB_PNG_H
+#define INC_LIB_PNG_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+struct pixel_t {
+  uint8_t red;
+  uint8_t green;
+  uint8_t blue;
+};
+
+struct bitmap_t {
+  struct pixel_t* image_buffer;
+  size_t width;
+  size_t height;
+};
+
+// Save bitmap to file
+void save_png(struct bitmap_t* bitmap, char* fname);
+
+#endif
diff --git a/include/lib/seg/util.h b/include/lib/seg/util.h
index c3c0060..fcafff6 100644
--- a/include/lib/seg/util.h
+++ b/include/lib/seg/util.h
@@ -31,4 +31,7 @@ uint16_t* combine_masks(uint16_t *destination, uint16_t *extra_labels, uint32_t
 //  starting_label_p will be incremented for each label found in the image
 uint16_t* tif_to_labels(char* tif_file_name, uint32_t *width, uint32_t *height, uint16_t *starting_label_p);
 
+// Convert mask to bitmap
+struct bitmap_t* uint16_to_bitmap(uint16_t* buffer, uint32_t width, uint32_t height);
+
 #endif
-- 
cgit v1.2.1