One well-known symbol of the philosophy of duality known as yin and yang is the taijitu.



Task

   Create a function that, given a parameter representing size, generates such a symbol scaled to the requested size.
   Generate and display the symbol for two different (small) sizes.


procedure DrawYinAndYang(Canv: TCanvas; R: TRect);
begin
  Canv.Brush.Color := clWhite;
  Canv.Pen.Color := clWhite;
  Canv.Pie(R.Left, R.Top, R.Right, R.Bottom,
    (R.Right + R.Left) div 2, R.Top, (R.Right + R.Left) div 2, R.Bottom);
  Canv.Brush.Color := clBlack;
  Canv.Pen.Color := clBlack;
  Canv.Pie(R.Left, R.Top, R.Right, R.Bottom,
    (R.Right + R.Left) div 2, R.Bottom, (R.Right + R.Left) div 2, R.Top);
  Canv.Brush.Color := clWhite;
  Canv.Pen.Color := clWhite;
  Canv.Ellipse((R.Right + 3 * R.Left) div 4, R.Top,
    (3 * R.Right + R.Left) div 4, (R.Top + R.Bottom) div 2);
  Canv.Brush.Color := clBlack;
  Canv.Pen.Color := clBlack;
  Canv.Ellipse((R.Right + 3 * R.Left) div 4, (R.Top + R.Bottom) div 2,
    (3 * R.Right + R.Left) div 4, R.Bottom);
 
  Canv.Brush.Color := clWhite;
  Canv.Pen.Color := clWhite;
  Canv.Ellipse((7 * R.Right + 9 * R.Left) div 16, (11 * R.Bottom + 5 * R.Top) div 16,
    (9 * R.Right + 7 * R.Left) div 16, (13 * R.Bottom + 3 * R.Top) div 16);
  Canv.Brush.Color := clBlack;
  Canv.Pen.Color := clBlack;
  Canv.Ellipse((7 * R.Right + 9 * R.Left) div 16, (3 * R.Bottom + 13 * R.Top) div 16,
    (9 * R.Right + 7 * R.Left) div 16, (5 * R.Bottom + 11 * R.Top) div 16);
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  ClientWidth := 400;
  ClientHeight := 400;
end;
 
procedure TForm1.FormPaint(Sender: TObject);
var
  R: TRect;
begin
  R := ClientRect;
  Canvas.Brush.Color := clGray;
  Canvas.FillRect(R);
 
  InflateRect(R, -50, -50);
  OffsetRect(R, -40, -40);
  DrawYinAndYang(Canvas, R);
 
  InflateRect(R, -90, -90);
  OffsetRect(R, 170, 170);
  DrawYinAndYang(Canvas, R);
end;
 