diff options
-rw-r--r-- | inc/cub3d.h | 2 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 7 | ||||
-rw-r--r-- | src/ft_hex_to_rgb.c | 6 | ||||
-rw-r--r-- | src/ft_save_to_bmp.c | 6 |
4 files changed, 15 insertions, 6 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index 732ccbe..c2e117e 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -128,6 +128,6 @@ uint8_t ft_free_words(char **words); int8_t ft_warp_level(t_cub *cl); int ft_exit(uint8_t exit_code, t_cub *clist); uint32_t ft_rgb_to_hex(t_rgb rgb); -t_rgb ft_hex_to_rgb(int32_t color); +t_bmp_rgb ft_hex_to_rgb(uint32_t color); # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 0773e11..ab99f7b 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -54,6 +54,13 @@ typedef struct s_bmp_info uint32_t colors_important; } t_bmp_info; +typedef struct s_bmp_rgb +{ + uint8_t r; + uint8_t g; + uint8_t b; +} t_bmp_rgb; + # pragma pack(pop) typedef struct s_img diff --git a/src/ft_hex_to_rgb.c b/src/ft_hex_to_rgb.c index 03e9643..81c474e 100644 --- a/src/ft_hex_to_rgb.c +++ b/src/ft_hex_to_rgb.c @@ -13,10 +13,10 @@ #include <cub3d.h> #include <stdint.h> -t_rgb - ft_hex_to_rgb(int32_t color) +t_bmp_rgb + ft_hex_to_rgb(uint32_t color) { - t_rgb rgb; + t_bmp_rgb rgb; rgb.r = ((color >> 16) & 0xff) / 255.0; rgb.g = ((color >> 8) & 0xff) / 255.0; diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index bc4547a..9526e62 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -47,7 +47,7 @@ static uint8_t *ft_convert_image_to_bmp(t_img img, t_cub *cl) { uint8_t *bmp; - t_rgb px; + t_bmp_rgb px; uint32_t y; uint32_t x; uint32_t i; @@ -63,7 +63,9 @@ 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(*(int*)(cl->img.ptr */ + /* + (x * 4 + (y * cl->img.sizeline)))); */ + px = ft_hex_to_rgb(0x00ff2222); *(bmp + i++) = (uint8_t)px.b; *(bmp + i++) = (uint8_t)px.g; *(bmp + i++) = (uint8_t)px.r; |