aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_renderer.c
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-11 08:43:17 -0400
committeriamcheeseman <[email protected]>2026-05-11 08:43:27 -0400
commit387d00660ff221576637d90cb9997276bdac3f8c (patch)
treeb483de9769d5127053ef6ca8da4448c05441fa4a /teensy/teensy_renderer.c
parentcd15c9789c9eeb9ec2fa367c39872685597e0c17 (diff)
transparent color
Diffstat (limited to 'teensy/teensy_renderer.c')
-rw-r--r--teensy/teensy_renderer.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/teensy/teensy_renderer.c b/teensy/teensy_renderer.c
index b51d2a9..d3f73fd 100644
--- a/teensy/teensy_renderer.c
+++ b/teensy/teensy_renderer.c
@@ -8,6 +8,8 @@
#include "teensy_context.h"
#include "teensy_list.h"
+#define BLEND_COLOR ty_color(255, 0, 255)
+
struct ty_renderer r;
static
@@ -134,10 +136,16 @@ void ty_draw_image(struct ty_image img, struct ty_vec2i pos)
for (int dy = y1; dy < y2; dy++) {
for (int dx = x1; dx < x2; dx++) {
+ struct ty_color px = ty_img_get_pixel(
+ img,
+ ty_vec2i(dx - x1, dy - y1)
+ );
+ if (memcmp(&px, &BLEND_COLOR, sizeof(px)) == 0)
+ continue;
ty_img_set_pixel(
r.screen,
ty_vec2i(dx, dy),
- ty_img_get_pixel(img, ty_vec2i(dx - x1, dy - y1))
+ px
);
}
}
@@ -157,11 +165,14 @@ void ty_draw_image_ex(
for (int dx = x1; dx < x2; dx++) {
int img_x = ((dx - x1) * src.w) / dst.w + src.x;
int img_y = ((dy - y1) * src.h) / dst.h + src.y;
+ struct ty_color px = ty_img_get_pixel(img, ty_vec2i(img_x, img_y));
+ if (memcmp(&px, &BLEND_COLOR, sizeof(px)) == 0)
+ continue;
ty_img_set_pixel(
r.screen,
ty_vec2i(dx, dy),
- ty_img_get_pixel(img, ty_vec2i(img_x, img_y))
+ px
);
}
}