Browse Source

+ implementation of DoEllipse

mazen 22 years ago
parent
commit
7f408f009d
1 changed files with 12 additions and 0 deletions
  1. 12 0
      fcl/image/fppixlcanv.pp

+ 12 - 0
fcl/image/fppixlcanv.pp

@@ -227,7 +227,19 @@ begin  //TODO
 end;
 
 procedure TFPPixelCanvas.DoEllipse (const Bounds:TRect);
+var
+  Cx,Cy,Rx,Ry,phi:Integer;
 begin  //TODO: how to find center points and radius from bounds ?
+  with Bounds do
+    begin
+      Cx:=(Right+Left) shr 2;
+      Cy:=(Bottom+Top) shr 2;
+      Rx:=Abs(Right-Left) shr 2;
+      Ry:=Abs(Bottom-Top) shr 2;
+    end;
+  MoveTo(Cx+Rx,Cy);
+  for phi:=1 to 360 do
+    LineTo(Cx+Round(Rx*Cos(phi*Pi/180)),Cy+Round(Ry*Sin(phi*Pi/180)));
 end;
 
 procedure TFPPixelCanvas.DoPolygonFill (const points:array of TPoint);