#include "fdf.h"

void	put_pixel_to_image(t_line *line, t_swap *s, t_FDF *FDF)
{
	int 	x;
	int 	y;

	x = line->p1.x;
	y = line->p1.y;
	if (s->swap_coord)
	{
		y = line->p1.x;
		x = line->p1.y;
	}
	if (x < 0)
		x = 0;
	if (x > FDF->w_width)
		x = FDF->w_width;
	if (y < 0)
		y = 0;
	if (y > FDF->w_height)
		y = FDF->w_height;
	*((int *)FDF->image_data + x + y * FDF->w_width) = color_to_int(
			choose_color(line, s, FDF));
}

