-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.c
35 lines (30 loc) · 1.42 KB
/
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* image.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kristori <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/08 12:46:07 by kristori #+# #+# */
/* Updated: 2022/11/15 13:29:29 by kristori ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
t_image ft_new_image(void *mlx, int width, int height)
{
t_image img;
img.reference = mlx_new_image(mlx, width, height);
img.size.x = width;
img.size.x = height;
img.pixels = mlx_get_data_addr(img.reference, &img.bits_per_pixel,
&img.line_size, &img.endian);
return (img);
}
t_image ft_new_sprite(void *mlx, char *path)
{
t_image img;
img.reference = mlx_xpm_file_to_image(mlx, path, &img.size.x, &img.size.y);
img.pixels = mlx_get_data_addr(img.reference, &img.bits_per_pixel,
&img.line_size, &img.endian);
return (img);
}