{Draw_line_without_multiplication (c) BeeLog écrit par denis Bertin - pour Vincent-Draw}

	{a,b,c,d is the coordinate (x,y) to (xx,yy)}

Procedure denis_line_attenuee(dc:hdc; a,b,c,d:real; color:tcolorref; centre_x,centre_y,rayon:integer);
var
	maximum:real;
	i,j:integer;
	dx,dy:real;


  procedure set_pixel_trans(PaintDC:hdc; x,y:integer; color:tcolorref);
	 var an_color:tcolorref;
		  transparence:real;
		  hue,lum,sat:real;
	 begin
	 transparence:=(maximum-utile.distance(centre_x,centre_y,x,y))/maximum;
	 an_color:=winprocs.getpixel(PaintDC,X,Y);
	 winprocs.setpixel(paintdc,X,Y,
		rgb(
			 min(255,round(getrvalue(color)*transparence+getrvalue(an_color))),
			 min(255,round(getgvalue(color)*transparence+getgvalue(an_color))),
			 min(255,round(getbvalue(color)*transparence+getbvalue(an_color))) ));
	 end; {set_pixel_trans}

  begin
  maximum:=utile.distance(centre_x,centre_y,centre_x+rayon,centre_y+rayon);
  if (a-c)=0 then
	 begin {vertical}
	 j:=round(a);
	 for i:=min(round(b),round(d)) to max(round(b),round(d)) do
		set_pixel_trans(dc,j,i,color);
	 exit;
	 end; {vertical}
  if (b-d)=0 then
	 begin {horizontal}
	 j:=round(b);
	 for i:=min(round(a),round(c)) to max(round(a),round(c)) do
		set_pixel_trans(dc,i,j,color);
	 exit;
	 end; {horizontal}

  {delta - différence}
  dx:=(b-d)/(a-c);
  dy:=(a-c)/(b-d);
  if abs(dx)<abs(dy) then
	begin {progression horizontal}
	 if a<c then
		begin {quartier 0-45°}
		for i:=round(a) to round(c) do
		  begin
		  b:=b+dx;
		  set_pixel_trans(dc,i,round(b),color);
		  end
		end {quartier 0-45°}
	 else
		begin {quartier 180°-135°}
		for i:=round(c) to round(a) do
		  begin
		  d:=d+dx;
		  set_pixel_trans(dc,i,round(d),color);
		  end
		end; {quartier 180°-135}
	end {progression horizontal}
  else
	begin {progression vertical}
	if b<d then
		begin {quartier 45°-90°}
		for i:=round(b) to round(d) do
			begin
			a:=a+dy;
			set_pixel_trans(dc,round(a),i,color);
			end;
		end {quartier 45°-90°}
	else
		begin {quartier 90°-135°}
		for i:=round(d) to round(b) do
			begin
			c:=c+dy;
			set_pixel_trans(dc,round(c),i,color);
			end;
		end; {quartier 90°-135°}
	end; {progression vertical}
end; {denis_line}