summaryrefslogtreecommitdiff
path: root/AnimationObject.c
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2026-03-16 20:59:04 +0200
committerSyndamia <kamen@syndamia.com>2026-03-16 20:59:04 +0200
commitc9333c94d9d2ee618b0d88e13d8cbb456809372b (patch)
tree19acc2895f1f4abcaf2063addb0f1811ff5514d8 /AnimationObject.c
parentef4a2773e90ebc6ed7ad66bcfd4e30165c04fb93 (diff)
downloadppm_graphics-c9333c94d9d2ee618b0d88e13d8cbb456809372b.tar
ppm_graphics-c9333c94d9d2ee618b0d88e13d8cbb456809372b.tar.gz
ppm_graphics-c9333c94d9d2ee618b0d88e13d8cbb456809372b.zip
feat: Implement horizontal line segment
Diffstat (limited to 'AnimationObject.c')
-rw-r--r--AnimationObject.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/AnimationObject.c b/AnimationObject.c
index 16489c3..87fe324 100644
--- a/AnimationObject.c
+++ b/AnimationObject.c
@@ -1,5 +1,6 @@
#include "AnimationObject.h"
#include <math.h>
+#include <stdlib.h>
ARGB
AO_CheckerPattern(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) {
@@ -64,3 +65,14 @@ AO_Line(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* p
return pixel;
}
+
+ARGB
+AO_HorSegment(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) {
+ struct AO_HorSegment hs = *(struct AO_HorSegment*)priv;
+
+ if (abs(r) <= hs.width && hs.left <= c && c <= hs.right) {
+ ARGB_set(&pixel, hs.color);
+ }
+
+ return pixel;
+}