summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render.c9
-rw-r--r--render.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/render.c b/render.c
index f50dd04..f42673b 100644
--- a/render.c
+++ b/render.c
@@ -165,6 +165,15 @@ Colour col_scl(Colour a, unsigned char s) {
return r;
}
+Colour col_add(Colour a, Colour b) {
+ Colour r;
+ r.r = ((int)a.r + (int)b.r) & 0xff;
+ r.g = ((int)a.g + (int)b.g) & 0xff;
+ r.b = ((int)a.b + (int)b.b) & 0xff;
+ r.a = ((int)a.a + (int)b.a) & 0xff;
+ return r;
+}
+
void ren_begin(Renderer* r, Colour* t, int* d, int w, int h) {
r->t = t;
r->vp[0] = w;
diff --git a/render.h b/render.h
index fcce37e..74bcd7f 100644
--- a/render.h
+++ b/render.h
@@ -42,6 +42,7 @@ Colour blend(Colour dst, Colour src);
Colour blend_mod(Colour dst, Colour src, Colour mod);
Colour col_mul(Colour a, Colour b);
Colour col_scl(Colour a, unsigned char s);
+Colour col_add(Colour a, Colour b);
typedef struct {
Colour* p;