-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_tools.c
34 lines (31 loc) · 1.44 KB
/
draw_tools.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw_tools.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbreton <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/20 08:15:12 by dbreton #+# #+# */
/* Updated: 2015/10/26 13:12:40 by dbreton ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
void put_in_image(t_mlx *s, int x, int y, int color)
{
char *start;
int bpp;
int size_line;
int endian;
unsigned int new_color;
start = mlx_get_data_addr(s->img, &bpp, &size_line, &endian);
new_color = mlx_get_color_value(s->mlx, color);
if (x < (WIN_MAX_X) && y < (WIN_MAX_Y)
&& x > 0 && y > 0)
{
start[(x * (bpp / 8)) + (y * size_line)] = new_color & 0xFF;
start[(x * (bpp / 8)) + (y * size_line) + 1] = (new_color
& 0xFF00) >> 8;
start[(x * (bpp / 8)) + (y * size_line) + 2] = (new_color
& 0xFFFF00) >> 16;
}
}