hedgewars/uLandGraphics.pas
changeset 7147 11b7b12e2b85
parent 7035 823caba67738
child 7150 fba3b14ff746
--- a/hedgewars/uLandGraphics.pas	Mon May 28 22:42:59 2012 +0400
+++ b/hedgewars/uLandGraphics.pas	Wed May 30 18:00:29 2012 +0400
@@ -39,6 +39,7 @@
 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
 function  LandBackPixel(x, y: LongInt): LongWord;
 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
+procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
 
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 
@@ -1056,4 +1057,39 @@
     end
 end;
 
+procedure DrawLines(X1, Y1, X2, Y2, dx, dy: LongInt; color: Longword);
+begin
+DrawLine(x1 + dx, y1 + dy, x2 + dx, y2 + dy, color);
+DrawLine(x1 + dx, y1 - dy, x2 + dx, y2 - dy, color);
+DrawLine(x1 - dx, y1 + dy, x2 - dx, y2 + dy, color);
+DrawLine(x1 - dx, y1 - dy, x2 - dx, y2 - dy, color);
+
+DrawLine(x1 + dy, y1 + dx, x2 + dy, y2 + dx, color);
+DrawLine(x1 + dy, y1 - dx, x2 + dy, y2 - dx, color);
+DrawLine(x1 - dy, y1 + dx, x2 - dy, y2 + dx, color);
+DrawLine(x1 - dy, y1 - dx, x2 - dy, y2 - dx, color);
+end;
+
+procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
+var dx, dy, d: LongInt;
+begin
+    dx:= 0;
+    dy:= Radius;
+    d:= 3 - 2 * Radius;
+    while (dx < dy) do
+        begin
+        DrawLines(x1, y1, x2, y2, dx, dy, color);
+        if (d < 0) then
+            d:= d + 4 * dx + 6
+        else
+            begin
+            d:= d + 4 * (dx - dy) + 10;
+            dec(dy)
+            end;
+        inc(dx)
+        end;
+    if (dx = dy) then
+        DrawLines(x1, y1, x2, y2, dx, dy, color);
+end;
+
 end.