16static int transition_color(
int start,
int end,
int move_point,
t_clr *color)
25 propo = (move_point - start) * 255 / span;
26 tr_r = color->start_r + ((color->end_r - color->start_r) * propo) / 255;
27 tr_g = color->start_g + ((color->end_g - color->start_g) * propo) / 255;
28 tr_b = color->start_b + ((color->end_b - color->start_b) * propo) / 255;
29 return ((tr_r << 16) | (tr_g << 8) | tr_b);
40 start = line->x_start;
42 move_point = plot->px;
46 start = line->y_start;
48 move_point = plot->py;
50 return (transition_color(start, end, move_point, color));
76 if (plot->px >= IMG_2D_WIDTH || plot->px <= 0
77 || plot->py >= IMG_2D_HEIGHT || plot->py <= 0)
79 plot->pc = get_current_color(plot, line, color);
80 my_mlx_pixel_put(img, plot->px, plot->py, plot->pc);
81 if (plot->px == line->x_end && plot->py == line->y_end)
83 plot->err2 = 2 * plot->err;
84 if (plot->err2 > -plot->dy)
86 plot->err -= plot->dy;
89 if (plot->err2 < plot->dx)
91 plot->err += plot->dx;
104 init_plot(&plot, line);
105 init_color(&color, line->color_start, line->color_end);
106 draw_loop(&plot, line, &color, img);
3D or 2D or Texture image