Hola!, lo que quiero hacer es voltear horizontalmente (como en Microsoft Word) un triangulo que he dibujado con el siguiente código:
En el form solo hay un TImage y un TButton
Código Delphi
[-]
implementation
procedure dda(x1, y1, x2, y2, r, g, b : Integer; image1 : TImage);
var
k, dx, dy, steps : Integer;
xInc, yInc, x, y : Real;
begin
dx := x2-x1;
dy := y2-y1;
if abs(dx) > abs(dy) then
begin
steps := abs(dx);
end
else
begin
steps := abs(dy);
end;
xInc := dx/steps;
yInc := dy/steps;
x := trunc(x1);
y := trunc(y1);
for k := 1 to steps do
begin
x := x+(xInc);
y := y+(yInc);
image1.canvas.Pixels[trunc(x), trunc(y)] := rgb(r, g, b);
end;
end;
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
for i := 10 to 150 do
begin
dda(i, 10, 150, i, 34, 177, 76, image1);
end;