-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrgb_utils.c
32 lines (28 loc) · 1.23 KB
/
rgb_utils.c
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
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rgb_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jaesjeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/03 11:59:14 by jaesjeon #+# #+# */
/* Updated: 2022/11/03 11:59:15 by jaesjeon ### ########.fr */
/* */
/* ************************************************************************** */
int create_trgb(unsigned char t, unsigned char r, \
unsigned char g, unsigned char b)
{
return (*(int *)(unsigned char [4]){b, g, r, t});
}
unsigned char get_r(int trgb)
{
return (((unsigned char *)&trgb)[2]);
}
unsigned char get_g(int trgb)
{
return (((unsigned char *)&trgb)[1]);
}
unsigned char get_b(int trgb)
{
return (((unsigned char *)&trgb)[0]);
}