about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-06 04:13:17 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-06 04:14:58 +0200
commitf94439ca8d5025252e9207cf831ec1e5d0e9a674 (patch)
treeb12f5a6be6cf8b575901a964d2300d532ef61e31 /src/types
parentd8b3680268a4390891e74f0b7b58d8cddabcd0b0 (diff)
downloadchawan-f94439ca8d5025252e9207cf831ec1e5d0e9a674.tar.gz
Refactor bitmap, add png color modes
Now PNG encoding/decoding, painting, etc. are done in separate files.
Plus we support all color modes except indexed color.
Diffstat (limited to 'src/types')
-rw-r--r--src/types/color.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/types/color.nim b/src/types/color.nim
index 818d4f5a..25c93d9b 100644
--- a/src/types/color.nim
+++ b/src/types/color.nim
@@ -346,7 +346,12 @@ func YUV*(Y, U, V: int): RGBColor =
   return rgb(r, g, b)
 
 func rgba*(r, g, b, a: int): RGBAColor =
-  return RGBAColor((uint32(a) shl 24) or (uint32(r) shl 16) or (uint32(g) shl 8) or uint32(b))
+  return RGBAColor((uint32(a) shl 24) or (uint32(r) shl 16) or
+    (uint32(g) shl 8) or uint32(b))
+
+func rgba*(r, g, b, a: uint8): RGBAColor =
+  return RGBAColor((uint32(a) shl 24) or (uint32(r) shl 16) or
+    (uint32(g) shl 8) or uint32(b))
 
 func gray*(n: int): RGBColor =
   return rgb(n, n, n) #TODO use yuv instead?