/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_darken_rgb.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/03/05 16:04:28 by rbousset #+# #+# */ /* Updated: 2020/03/05 16:04:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include uint32_t 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; darker.r /= calc; darker.g /= calc; darker.b /= calc; return (ft_rgb_to_hex(darker)); }