RT
color.h
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* color.h :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: nihuynh <nihuynh@student.42.fr> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2018/11/30 09:14:13 by nihuynh #+# #+# */
9 /* Updated: 2019/05/12 06:27:05 by nihuynh ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #ifndef COLOR_H
14 # define COLOR_H
15 
16 # include <stdint.h>
17 # include <stdbool.h>
18 
19 # define SHIFT_RED 16
20 # define SHIFT_GREEN 8
21 # define SHIFT_BLUE 0
22 
23 typedef struct s_color
24 {
25  float r;
26  float g;
27  float b;
28 } t_color;
29 
30 void color_mult(t_color *color, t_color *mult);
31 t_color color_mult_(t_color color, t_color mult);
32 void color_scalar(t_color *color, float k);
33 t_color color_scalar_(t_color color, float k);
34 void color_add(t_color *color, t_color add);
35 t_color color_add_(t_color color, t_color add);
36 t_color color_sub(t_color color, t_color sub);
37 void color_max(t_color *col1, t_color *col2);
38 void color_clamp(t_color *color, float min, float max);
39 bool color_bool(t_color color);
40 t_color itocolor(int color);
41 int colortoi(t_color color);
42 t_color color_linear_inter(t_color color0, t_color color1, float value);
43 
44 #endif
color_linear_inter
t_color color_linear_inter(t_color color0, t_color color1, float value)
Definition: color_linear_inter.c:15
itocolor
t_color itocolor(int color)
Definition: itocolor.c:16
s_color
Definition: color.h:23
color_mult_
t_color color_mult_(t_color color, t_color mult)
Definition: color_mult.c:22
color_add_
t_color color_add_(t_color color, t_color add)
Definition: color_add.c:23
colortoi
int colortoi(t_color color)
Definition: colortoi.c:15
color_bool
bool color_bool(t_color color)
Definition: color_bool.c:15
color_sub
t_color color_sub(t_color color, t_color sub)
Definition: color_sub.c:16
color_scalar
void color_scalar(t_color *color, float k)
Definition: color_scalar.c:16
s_color::b
float b
Definition: color.h:27
s_color::g
float g
Definition: color.h:26
color_clamp
void color_clamp(t_color *color, float min, float max)
Definition: color_clamp.c:16
color_add
void color_add(t_color *color, t_color add)
Definition: color_add.c:16
color_mult
void color_mult(t_color *color, t_color *mult)
Definition: color_mult.c:15
s_color::r
float r
Definition: color.h:25
color_max
void color_max(t_color *col1, t_color *col2)
Definition: color_max.c:16
color_scalar_
t_color color_scalar_(t_color color, float k)
Definition: color_scalar.c:23
t_color
struct s_color t_color