unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, ComCtrls, StdCtrls, TeEngine, Series, TeeProcs, Chart,
  Clipbrd;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    TabSheet2: TTabSheet;
    Image1: TImage;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  x1, x2, y1, y2 : integer;
  xomin, xomax, yomin, yomax : extended;
  r1, r2 : extended;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.Text:='2';
  Edit2.Text:='0';
  Edit3.Text:='2';
  Edit4.Text:='7';
  Edit5.Text:='3';
  Edit6.Text:='1';
  Edit7.Text:='0';
  Edit8.Text:='10';
  Edit9.Text:='0';
  Edit10.Text:='10';
  x1:=round(StrToFloat(Edit1.Text));
  y1:=round(StrToFloat(Edit2.Text));
  r1:=StrToFloat(Edit3.Text);
  x2:=round(StrToFloat(Edit4.Text));
  y2:=round(StrToFloat(Edit5.Text));
  r2:=StrToFloat(Edit6.Text);
  xomin:=StrToFloat(Edit7.Text);
  xomax:=StrToFloat(Edit8.Text);
  yomin:=StrToFloat(Edit9.Text);
  yomax:=StrToFloat(Edit10.Text);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  xmax,ymax,yo:integer;
  hx, hy : extended;
begin
  Image1.Canvas.Pen.Color:=clWhite;
  Image1.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);
  x1:=round(StrToFloat(Edit1.Text));
  y1:=round(StrToFloat(Edit2.Text));
  r1:=StrToFloat(Edit3.Text);
  x2:=round(StrToFloat(Edit4.Text));
  y2:=round(StrToFloat(Edit5.Text));
  r2:=StrToFloat(Edit6.Text);
  xomin:=StrToFloat(Edit7.Text);
  xomax:=StrToFloat(Edit8.Text);
  yomin:=StrToFloat(Edit9.Text);
  yomax:=StrToFloat(Edit10.Text);
  with Image1.Canvas do
  begin
    xmax:=Image1.Width;
    ymax:=Image1.Height;

    yo:=ymax div 2;
    Pen.Color:=clRed;
    Pen.Width:=2;
    hx:=(xomax-xomin)/xmax;
    hy:=(yomax-yomin)/ymax;
    Brush.Color:=clWhite;
    if r1>r2 then
    begin{}
      Image1.Canvas.Ellipse(round((x1-r1)/hx),round(yo-(y1-r1)/hy),round((x1+r1)/hx),round(yo-(y1+r1)/hy));
      Image1.Canvas.Ellipse(round((x2-r2)/hx),round(yo-(y2-r2)/hy),round((x2+r2)/hx),round(yo-(y2+r2)/hy));
    end else
    begin
      Image1.Canvas.Ellipse(round((x2-r2)/hx),round(yo-(y2-r2)/hy),round((x2+r2)/hx),round(yo-(y2+r2)/hy));
      Image1.Canvas.Ellipse(round((x1-r1)/hx),round(yo-(y1-r1)/hy),round((x1+r1)/hx),round(yo-(y1+r1)/hy));
    end;{}
    Pen.Color:=clBlack;
    MoveTo(0,yo);
    LineTo(xmax,yo);
    MoveTo(0,0);
    LineTo(0,ymax);
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ClipBoard.Assign(Image1.Picture);
end;

end.
