Cube3d/srcs/exec/image.c

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* image.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jle-neze <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/12 18:19:47 by jle-neze #+# #+# */
/* Updated: 2025/09/12 18:19:49 by jle-neze ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub.h"
void img_put_pixel(t_img *img, int x, int y, int color)
{
char *dst;
if (x < 0 || y < 0 || x >= img->w || y >= img->h)
return ;
dst = img->addr + (y * img->line_len + x * (img->bpp / 8));
*(unsigned int *)dst = (unsigned int)color;
}