# Newly authored geometric icon artwork, rendered to a portable PNG atlas. from PIL import Image,ImageDraw from math import sin,cos,pi S=4; im=Image.new('RGBA',(1024*S,1024*S));d=ImageDraw.Draw(im) for i in range(16): ox=(i%4)*256;oy=(i//4)*256 def p(x,y):return ((ox+32+x*8)*S,(oy+32+y*8)*S) def poly(pts,fill='white'):d.polygon([p(*v) for v in pts],fill=fill) def line(pts,w=2.3): d.line([p(*v) for v in pts],fill='white',width=int(w*8*S),joint='curve') for x,y in [pts[0],pts[-1]]:ell(x-w/2,y-w/2,x+w/2,y+w/2) def ell(a,b,c,e,fill='white'):d.ellipse([p(a,b),p(c,e)],fill=fill) def rect(a,b,c,e,r=1.4):d.rounded_rectangle([p(a,b),p(c,e)],radius=r*8*S,fill='white') def turn(clock=True): pts=[(12+7*cos((-60+j*290/60)*pi/180),12+7*sin((-60+j*290/60)*pi/180)) for j in range(61)] if not clock:pts=[(24-x,y)for x,y in pts] line(pts);x,y=pts[-1];vx=x-pts[-2][0];vy=y-pts[-2][1];n=(vx*vx+vy*vy)**.5;vx/=n;vy/=n poly([(x+vx*2,y+vy*2),(x-vx*3-vy*3,y-vy*3+vx*3),(x-vx*3+vy*3,y-vy*3-vx*3)]) if i==0: poly([(12+(9 if j%4 in [0,1] else 7)*cos(j*pi/16),12+(9 if j%4 in [0,1] else 7)*sin(j*pi/16))for j in range(32)]);ell(8.5,8.5,15.5,15.5,(0,0,0,0)) elif i==1: for x,y in [(3,3),(14,3),(3,14),(14,14)]:rect(x,y,x+7,y+7) elif i==2:line([(15,4),(7,12),(15,20)],3) elif i==3:line([(5,5),(19,19)],3);line([(19,5),(5,19)],3) elif i in [4,5,7]:turn(i!=4) elif i==6:line([(5,8),(14,8),(18,10),(19,14),(17,18),(13,19)]);poly([(2,8),(9,2),(9,14)]) elif i==8:ell(5,2,19,16);rect(9,14,15,19);line([(10,22),(14,22)],2) elif i==9:poly([(12+(10 if j%2==0 else 4.8)*cos(-pi/2+j*pi/5),12+(10 if j%2==0 else 4.8)*sin(-pi/2+j*pi/5))for j in range(10)]) elif i==10:poly([(4,16),(16,4),(20,8),(8,20),(3,21)]) elif i==11:poly([(6,3),(21,12),(6,21)]) elif i==12:poly([(12,2),(22,12),(16,12),(16,22),(8,22),(8,12),(2,12)]) elif i==13:poly([(3,15),(14,3),(22,11),(12,21),(9,21)]) elif i==14:line([(5,20),(8,19),(10,16),(12,8),(14,5),(19,4)],3) else:poly([(12+10*cos(j*pi/3),12+10*sin(j*pi/3))for j in range(6)]) im.resize((1024,1024),Image.Resampling.LANCZOS).save('assets/ui-icons-flat.png')