Quote Originally Posted by Mirage View Post
OMG, Sqrt/ArcCos within the inner cycle!
http://cboard.cprogramming.com/game-...algorithm.html
But your link does not refer to a filled circle algorithm. You see in my first post I had a solution without sqrt. But it was awfully slow.
I came to this, which is fast and does not overlap anymore (this can be seen when drawing alphablended):
Code:
procedure fillcircle (cx,cy,r:integer); 
var x,y,r2,dx:integer;
begin
    if r = 0 then begin
        r:=1;
    end;
   r2 := r * r;
   for x := r downto 0 do begin
      y := round(sqrt(r2 - x*x));
      dx := cx - x;
      line(dx-1, cy-y, dx-1, cy+y);
      dx := cx + x;
      line(dx, cy-y, dx, cy+y);
      end;
end;