-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixel_utils.c
25 lines (22 loc) · 1.2 KB
/
pixel_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pixel_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mvalient <mvalient@student.42urduliz.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/12 13:47:50 by mvalient #+# #+# */
/* Updated: 2022/12/21 13:26:33 by mvalient ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void ft_put_pixel(t_img *img, int x, int y, int color)
{
char *dst;
if (x > WIDTH || y > HEIGHT || x < 0 || y < 0)
return ;
dst = img->addr + (y * img->line_length + x * (img->bits_per_pixel / 8));
*(unsigned int *) dst = color;
if (DEBUG)
ft_printf("Setting pixel X: %d, Y: %d, Color: %X\n", x, y, color);
}