summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-08-04 15:33:33 +1000
committerquou <quou@disroot.org>2024-08-04 15:33:33 +1000
commit9c2f9a59096b5ec449c7557afb3220ed2597c4ea (patch)
treedc90dd25461722c92610514aae0eb7cd3b4cced9
parenta0c6f0eea627058beb834c72cd3d521f8ed08459 (diff)
col_scl
-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 a55e062..3e5758b 100644
--- a/render.c
+++ b/render.c
@@ -156,6 +156,15 @@ Colour col_mul(Colour a, Colour b) {
return r;
}
+Colour col_scl(Colour a, unsigned char s) {
+ Colour r;
+ r.r = (a.r * s) >> 8;
+ r.g = (a.g * s) >> 8;
+ r.b = (a.b * s) >> 8;
+ r.a = (a.a * s) >> 8;
+ 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 a30331f..fcce37e 100644
--- a/render.h
+++ b/render.h
@@ -41,6 +41,7 @@ Colour make_black(void);
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);
typedef struct {
Colour* p;