unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure Antialising(C: TCanvas; Rect: TRect; Percent: Integer); var l, p: Integer; R, G, B: Integer; R1, R2, G1, G2, B1, B2: Byte; begin with c do begin Brush.Style := bsclear; lineto(200, 100); moveto(50, 150); Ellipse(50, 150, 200, 30); for l := Rect.Top to Rect.Bottom do begin for p := Rect.Left to Rect.Right do begin R1 := GetRValue(Pixels[p, l]); G1 := GetGValue(Pixels[p, l]); B1 := GetBValue(Pixels[p, l]); //Pixel links //Pixel left R2 := GetRValue(Pixels[p - 1, l]); G2 := GetGValue(Pixels[p - 1, l]); B2 := GetBValue(Pixels[p - 1, l]); if (R1 <> R2) or (G1 <> G2) or (B1 <> B2) then begin R := Round(R1 + (R2 - R1) * 50 / (Percent + 50)); G := Round(G1 + (G2 - G1) * 50 / (Percent + 50)); B := Round(B1 + (B2 - B1) * 50 / (Percent + 50)); Pixels[p - 1, l] := RGB(R, G, B); end; //Pixel rechts //Pixel right R2 := GetRValue(Pixels[p + 1, l]); G2 := GetGValue(Pixels[p + 1, l]); B2 := GetBValue(Pixels[p + 1, l]); if (R1 <> R2) or (G1 <> G2) or (B1 <> B2) then begin R := Round(R1 + (R2 - R1) * 50 / (Percent + 50)); G := Round(G1 + (G2 - G1) * 50 / (Percent + 50)); B := Round(B1 + (B2 - B1) * 50 / (Percent + 50)); Pixels[p + 1, l] := RGB(R, G, B); end; //Pixel oben //Pixel up R2 := GetRValue(Pixels[p, l - 1]); G2 := GetGValue(Pixels[p, l - 1]); B2 := GetBValue(Pixels[p, l - 1]); if (R1 <> R2) or (G1 <> G2) or (B1 <> B2) then begin R := Round(R1 + (R2 - R1) * 50 / (Percent + 50)); G := Round(G1 + (G2 - G1) * 50 / (Percent + 50)); B := Round(B1 + (B2 - B1) * 50 / (Percent + 50)); Pixels[p, l - 1] := RGB(R, G, B); end; //Pixel unten //Pixel down R2 := GetRValue(Pixels[p, l + 1]); G2 := GetGValue(Pixels[p, l + 1]); B2 := GetBValue(Pixels[p, l + 1]); if (R1 <> R2) or (G1 <> G2) or (B1 <> B2) then begin R := Round(R1 + (R2 - R1) * 50 / (Percent + 50)); G := Round(G1 + (G2 - G1) * 50 / (Percent + 50)); B := Round(B1 + (B2 - B1) * 50 / (Percent + 50)); Pixels[p, l + 1] := RGB(R, G, B); end; end; end; end; end; procedure TForm1.Button1Click(Sender: TObject); var i,x,R,lx,ly:integer; dx:real; procedure draww(x,y:integer); var rec:trect; a:real; my,mx:integer; begin a:=(x-lx)/R; my:=round(r*sin(a)); mx:=round(r*cos(a)); rec.Left:=x-r-1; rec.Top:=y-r-1; rec.Right:=x+r; rec.Bottom:=y+r+1; canvas.FillRect(rec); canvas.Ellipse(x-r,y-r,x+r,y+r); canvas.MoveTo(x+mx,y+my); canvas.LineTo(x-mx,y-my); canvas.MoveTo(x-my,y+mx); canvas.LineTo(x+my,y-mx); end; begin canvas.FillRect(canvas.ClipRect); lx:=40; ly:=150; R:=30; dx:=0.1; x:=lx; for i:=lx to 300 do begin x:=round(i); sleep(5); application.ProcessMessages; draww(x,ly); end; end; end.