const const_pi=3.141592654;
Const_DegToRad=const_pi/180;
color1=clwhite;
color2=clblack;
var invertcolor:boolean=false;
procedure TForm1.FormPaint(Sender: TObject);
var Diameter,radius,halfRadius,x,y:single;
penwidth:single=5.5;
b:tbgrabitmap;
drawcolor1:tcolor=color1;
drawcolor2:tcolor=color2;
adjX:single;
begin
adjX:=penwidth/const_pi;
if invertcolor then
begin
drawcolor1:=color2;
drawcolor2:=color1;
end;
if width<height then Diameter:=width-penwidth else Diameter:=height-penwidth;
halfRadius:=Diameter / 4;
radius:=Diameter / 2;
x:=(width-Diameter) / 2;
y:=(height-Diameter) / 2;
b:=tbgrabitmap.Create(width,height);
//draw white circle
b.EllipseAntialias(x+radius,y+radius,radius,radius,clblack,penwidth,drawcolor1);
//draw half circle on right
b.FillPie(x+radius,y+radius,radius,radius,-90*Const_DegToRad,90*Const_DegToRad,drawcolor2);
//draw top circle
b.EllipseAntialias(x+radius,y+halfRadius+adjX,halfRadius-adjX,halfRadius-adjX,clblack,0,drawcolor1);
//draw bottom circle
b.EllipseAntialias(x+radius,y+halfRadius+radius-adjX,halfRadius-adjX,halfRadius-adjX,clwhite,0,drawcolor2);
//draw top eye
b.EllipseAntialias(x+radius,y+halfRadius,halfRadius/3,halfRadius/3,clblack,0,drawcolor2);
//draw bottom eye
b.EllipseAntialias(x+radius,y+halfRadius+radius,halfRadius/3,halfRadius/const_pi,clwhite,0,drawcolor1);
form1.Canvas.Draw(0,0,b.Bitmap);
b.free;
end;