aboutsummaryrefslogtreecommitdiff
path: root/core/image/common.odin
diff options
context:
space:
mode:
authorWalterPlinge <22519813+WalterPlinge@users.noreply.github.com>2022-04-18 01:00:19 +0100
committerWalterPlinge <22519813+WalterPlinge@users.noreply.github.com>2022-04-18 20:29:37 +0100
commit8d370fabdd7925f1856a998063ef5de49f4efa2a (patch)
tree96eba1357414fecebb07d76306751204a083e0ad /core/image/common.odin
parentdf4a0c62add28af74ac8c926b3a6e0612296ccd1 (diff)
Added initial Netpbm image format support
Diffstat (limited to 'core/image/common.odin')
-rw-r--r--core/image/common.odin46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/image/common.odin b/core/image/common.odin
index 2e7bca17e..bf93e9313 100644
--- a/core/image/common.odin
+++ b/core/image/common.odin
@@ -57,6 +57,7 @@ Image :: struct {
}
Image_Metadata :: union {
+ ^Netpbm_Info,
^PNG_Info,
^QOI_Info,
}
@@ -152,6 +153,7 @@ Options :: distinct bit_set[Option]
Error :: union #shared_nil {
General_Image_Error,
+ Netpbm_Error,
PNG_Error,
QOI_Error,
@@ -172,6 +174,50 @@ General_Image_Error :: enum {
}
/*
+ Netpbm-specific definitions
+*/
+Netpbm_Format :: enum {
+ P1, P2, P3, P4, P5, P6, P7, Pf, PF,
+}
+
+Netpbm_Header :: struct {
+ format: Netpbm_Format,
+ width: int,
+ height: int,
+ channels: int,
+ depth: int,
+ maxval: int,
+ tupltype: string,
+ scale: f32,
+ little_endian: bool,
+}
+
+Netpbm_Info :: struct {
+ header: Netpbm_Header,
+}
+
+Netpbm_Error :: enum {
+ None = 0,
+
+ // reading
+ File_Not_Readable,
+ Invalid_Signature,
+ Invalid_Header_Token_Character,
+ Incomplete_Header,
+ Invalid_Header_Value,
+ Duplicate_Header_Field,
+ Buffer_Too_Small,
+ Invalid_Buffer_ASCII_Token,
+ Invalid_Buffer_Value,
+
+ // writing
+ File_Not_Writable,
+ Invalid_Format,
+ Invalid_Number_Of_Channels,
+ Invalid_Image_Depth,
+}
+
+/*
PNG-specific definitions
*/
PNG_Error :: enum {