-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor_manager.c
56 lines (53 loc) · 1.64 KB
/
color_manager.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color_manager.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kprytkov <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/06/06 17:30:09 by kprytkov #+# #+# */
/* Updated: 2018/06/06 17:30:10 by kprytkov ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/fractol.h"
static void more_colors(t_env *e, int depth)
{
if (e->choose_color == 2)
{
e->red = (SQR(depth) * 30) % 255;
e->blue = (SQR(depth) * 80) % 255;
e->green = (depth * 40) % 255;
}
else if (e->choose_color == 3)
{
e->red = (depth * 5) % 255;
e->blue = (depth * 5) % 255;
e->green = (depth * 5) % 255;
}
}
void choose_color(t_env *e, int depth)
{
if (e->choose_color == 0)
{
if (depth == e->infinity)
{
e->red = 0;
e->blue = 0;
e->green = 0;
}
else
{
e->red = (depth * 3) % 255;
e->blue = (depth * 7) % 255;
e->green = (depth * 4) % 255;
}
}
else if (e->choose_color == 1)
{
e->red = (depth * 7) % 255;
e->blue = (depth * 2) % 70;
e->green = (depth * 3) % 4;
}
else
more_colors(e, depth);
}