]> git.lizzy.rs Git - nothing.git/blobdiff - src/color.h
Implement chop_background_layer
[nothing.git] / src / color.h
index 42db83ca5161d6c25c4f3e95f32757c4c753576c..cffb7cf613f7e787d84fc6d76f58cb3447a27935 100644 (file)
@@ -1,19 +1,41 @@
 #ifndef COLOR_H_
 #define COLOR_H_
 
-#include <SDL2/SDL.h>
+#include <stdio.h>
+#include <SDL.h>
+#include "./system/s.h"
+
+#define COLOR_BLACK rgba(0.0f, 0.0f, 0.0f, 1.0f)
+#define COLOR_WHITE rgba(1.0f, 1.0f, 1.0f, 1.0f)
+#define COLOR_RED rgba(1.0f, 0.0f, 0.0f, 1.0f)
 
 typedef struct Color {
     float r, g, b, a;
 } Color;
 
-Color color(float r, float g, float b, float a);
-Color color256(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-Color color_from_hexstr(const char *hexstr);
+Color rgba(float r, float g, float b, float a);
+Color hsla(float h, float s, float l, float a);
+Color rgba_to_hsla(Color color);
+Color hexstr(const char *hexstr);
+Color hexs(String input);
 SDL_Color color_for_sdl(Color color);
 
+int color_hex_to_stream(Color color, FILE *stream);
+int color_hex_to_string(Color color, char *buffer, size_t buffer_size);
+
 Color color_darker(Color color, float d);
 
 Color color_desaturate(Color color);
 
+Color color_invert(Color c);
+
+Color color_scale(Color c, Color fc);
+
+static inline
+Color color_set_alpha(Color c, float a)
+{
+    c.a = a;
+    return c;
+}
+
 #endif  // COLOR_H_