mixster

mixster

Mar 22nd, 2010
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.11 KB | None | 0 0
  1. const
  2.   largeRadius = 100;
  3.   smallRadius = 50;
  4.   largeLim = largeRadius * largeRadius;
  5.   smallLim = smallRadius * smallRadius;
  6.   imgSize = 400;
  7.   cen = imgSize div 2;
  8.  
  9. var
  10.   b, x, a, y, c: Integer;
  11.   u: Boolean;
  12. begin
  13.   DisplayDebugImgWindow(imgSize, imgSize);
  14.   b := BitmapFromString(imgSize, imgSize, '');
  15.  
  16.   a := 0;
  17.   u := True;
  18.   for c := 0 to largeLim do
  19.   begin
  20.     if (u) then
  21.       Inc(a)
  22.     else
  23.       Dec(a);
  24.     if (u) then
  25.       x := Round(Sqrt(c) + Sqrt(a))
  26.     else
  27.       x := Round(Sqrt(c) - Sqrt(a));
  28.     y := Round(Sqrt(largeLim - c) + Sqrt(smallLim - a));
  29.     FastSetPixel(b, cen + x, cen - y, clRed);
  30.     FastSetPixel(b, cen + x, cen + y, clRed);
  31.     FastSetPixel(b, cen - x, cen + y, clRed);
  32.     FastSetPixel(b, cen - x, cen - y, clRed);
  33.     y := Round(Sqrt(largeLim - c) - Sqrt(smallLim - a));
  34.     FastSetPixel(b, cen + x, cen - y, clRed);
  35.     FastSetPixel(b, cen + x, cen + y, clRed);
  36.     FastSetPixel(b, cen - x, cen + y, clRed);
  37.     FastSetPixel(b, cen - x, cen - y, clRed);
  38.  
  39.     if (not InRange(a, 1, 2499)) then
  40.       u := not u;
  41.   end;
  42.  
  43.   DrawBitmapDebugImg(b);
  44. end.
Add Comment
Please, Sign In to add comment