From c51419a68e38ed3a2eb28e740f72eaa436fbd106 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 9 Mar 2020 01:52:21 +0100 Subject: Boy --- src/ft_darken_rgb.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'src/ft_darken_rgb.c') diff --git a/src/ft_darken_rgb.c b/src/ft_darken_rgb.c index 656aac7..4c571cf 100644 --- a/src/ft_darken_rgb.c +++ b/src/ft_darken_rgb.c @@ -14,33 +14,20 @@ #include uint32_t - ft_darken_ceil(t_rgb rgb, int32_t y, t_cub *cl) + ft_darken(t_rgb rgb, t_cub *cl) { t_rgb darker; float calc; + float dist; + if ((dist = cl->rlist.row_dist) <= 0) + dist = 0.0001; + calc = (dist * 0.4); + calc = (calc >= 255) ? (255) : (calc); + calc = (calc < 1) ? (1) : (calc); darker = rgb; - calc = ((float)(y - (75000.0 / cl->wlist.y_size)) - / (cl->wlist.y_size / 2)); - calc = (calc < 0) ? (0) : (calc); - darker.r *= 1 - calc; - darker.g *= 1 - calc; - darker.b *= 1 - calc; + darker.r /= calc; + darker.g /= calc; + darker.b /= calc; return (ft_rgb_to_hex(darker)); } - -/* uint32_t */ -/* ft_darken_floor(t_rgb rgb, int32_t y, t_cub *cl) */ -/* { */ -/* t_rgb darker; */ -/* float calc; */ - -/* calc = ((float)(y + (75000.0 / cl->wlist.y_size)) */ -/* / (cl->wlist.y_size / 2)) - 1.0; */ -/* calc = (calc < 0) ? (0) : (calc); */ -/* darker = rgb; */ -/* darker.r *= calc; */ -/* darker.g *= calc; */ -/* darker.b *= calc; */ -/* return (ft_rgb_to_hex(darker)); */ -/* } */ -- cgit v1.2.3