-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmlx_image.c
39 lines (33 loc) · 1.41 KB
/
mlx_image.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* mlx_image.c :+: :+: */
/* +:+ */
/* By: jandre-d <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/06/30 16:12:37 by jandre-d #+# #+# */
/* Updated: 2019/07/05 17:10:22 by jandre-d ######## odam.nl */
/* */
/* ************************************************************************** */
#include "wolf.h"
unsigned *image_get_data_ptr(void *img_ptr)
{
int trash;
return ((unsigned *)mlx_get_data_addr(img_ptr,
&trash, &trash, &trash));
}
void image_push(t_wolf *wolf_ptr)
{
mlx_put_image_to_window(
wolf_ptr->mlx_ptr, wolf_ptr->win_ptr, wolf_ptr->img_ptr, 0, 0);
}
void image_set_pixel(unsigned *img_data, int x, int y,
unsigned color)
{
if (y < HEIGHT && x < WIDTH && y >= 0 && x >= 0)
img_data[(y * WIDTH) + x] = color;
}
void image_clear(unsigned *img_data)
{
ft_memset((void *)img_data, 0, BPP * WIDTH * HEIGHT);
}