aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_hex_to_rgb.c
blob: 03e96430932bceabd20a1ed9b3895e832e9c7587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_hex_to_rgb.c                                    :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:28:58 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:28:58 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <stdint.h>

t_rgb
	ft_hex_to_rgb(int32_t color)
{
	t_rgb	rgb;

	rgb.r = ((color >> 16) & 0xff) / 255.0;
	rgb.g = ((color >> 8) & 0xff) / 255.0;
	rgb.b = ((color) & 0xff) / 255.0;
	return (rgb);
}