diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-05 00:35:30 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-05 00:35:30 +0100 |
commit | 3cb1ee41e7d449586830aac703f64e2b66a75e7d (patch) | |
tree | e3b2932e980c82e44848be1637ec911e8e6aae26 | |
parent | How do I convert hex to rgb pls (diff) | |
download | 42-cub3d-3cb1ee41e7d449586830aac703f64e2b66a75e7d.tar.gz 42-cub3d-3cb1ee41e7d449586830aac703f64e2b66a75e7d.tar.bz2 42-cub3d-3cb1ee41e7d449586830aac703f64e2b66a75e7d.tar.xz 42-cub3d-3cb1ee41e7d449586830aac703f64e2b66a75e7d.tar.zst 42-cub3d-3cb1ee41e7d449586830aac703f64e2b66a75e7d.zip |
okokokokok
Diffstat (limited to '')
-rw-r--r-- | src/ft_hex_to_rgb.c | 6 | ||||
-rw-r--r-- | src/ft_save_to_bmp.c | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/ft_hex_to_rgb.c b/src/ft_hex_to_rgb.c index 81c474e..30332cc 100644 --- a/src/ft_hex_to_rgb.c +++ b/src/ft_hex_to_rgb.c @@ -18,8 +18,8 @@ t_bmp_rgb { t_bmp_rgb rgb; - rgb.r = ((color >> 16) & 0xff) / 255.0; - rgb.g = ((color >> 8) & 0xff) / 255.0; - rgb.b = ((color) & 0xff) / 255.0; + rgb.r = (color >> 16) & 255; + rgb.g = (color >> 8) & 255; + rgb.b = color & 255; return (rgb); } diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index 9526e62..648cba6 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -63,9 +63,8 @@ static uint8_t x = -1; while (++x < cl->wlist.x_size) { - /* px = ft_hex_to_rgb(*(int*)(cl->img.ptr */ - /* + (x * 4 + (y * cl->img.sizeline)))); */ - px = ft_hex_to_rgb(0x00ff2222); + px = ft_hex_to_rgb(*(int*)(cl->img.ptr + + (x * 4 + (y * cl->img.sizeline)))); *(bmp + i++) = (uint8_t)px.b; *(bmp + i++) = (uint8_t)px.g; *(bmp + i++) = (uint8_t)px.r; |