Import Amiga applications and desktop tools
This commit is contained in:
commit
1c144c9a3c
347 files changed
+423483
No files matched your search
@@ -0,0 +1,38 @@
|
||||
from PIL import Image,ImageDraw,ImageFont
|
||||
from pathlib import Path
|
||||
import math,struct
|
||||
p=Path(__file__).parent
|
||||
S=3
|
||||
im=Image.new('RGB',(320*S,430*S),'#141310');d=ImageDraw.Draw(im)
|
||||
def ellipse(box,fill=None,outline=None,width=1):d.ellipse(tuple(int(v*S) for v in box),fill,outline,width*S)
|
||||
def line(points,fill,width=1):d.line([(int(x*S),int(y*S)) for x,y in points],fill,width*S)
|
||||
fontpath='C:/Windows/Fonts/consola.ttf'
|
||||
def text(x,y,t,size,color):
|
||||
f=ImageFont.truetype(fontpath,size*S); d.text((x*S,y*S),t,font=f,fill=color,anchor='mm')
|
||||
for r in range(148,134,-1):
|
||||
c=int(42+(148-r)*3);ellipse((160-r,158-r,160+r,158+r),(c,int(c*.74),int(c*.39)))
|
||||
ellipse((25,23,295,293),'#1b1914','#dfad61',1)
|
||||
ellipse((29,27,291,289),None,'#413723',1)
|
||||
for i in range(60):
|
||||
a=i*math.pi/30; r=123; ri=111 if i%5==0 else 118
|
||||
line([(160+math.sin(a)*ri,158-math.cos(a)*ri),(160+math.sin(a)*r,158-math.cos(a)*r)],'#e3c693' if i%5==0 else '#726147',2 if i%5==0 else 1)
|
||||
for n in (12,1,2,3,4,5,6,7,8,9,10,11):
|
||||
a=n*math.pi/6;text(160+math.sin(a)*96,158-math.cos(a)*96,str(n),16,'#ecdcbd')
|
||||
text(160,308,'PRECISION / LOCAL TIME',8,'#b59561')
|
||||
d.rounded_rectangle((12*S,326*S,308*S,417*S),radius=8*S,fill='#0c0d0b',outline='#73542b',width=S)
|
||||
text(160,338,'D I G I T A L / 2 4 H',8,'#a78a56')
|
||||
im=im.resize((320,430),Image.Resampling.LANCZOS)
|
||||
# Fixed palette shared by the face, hands, digits and glow levels.
|
||||
base=[(20,19,16),(236,220,189),(255,183,66),(100,72,34),(48,35,18),(197,145,66)]
|
||||
pal=im.quantize(colors=58).getpalette()[:58*3]
|
||||
colors=base+[tuple(pal[i:i+3]) for i in range(0,len(pal),3)]
|
||||
pi=Image.new('P',(1,1));pi.putpalette(sum(map(list,colors),[])+[0]*(768-len(colors)*3))
|
||||
indexed=im.quantize(palette=pi,dither=Image.Dither.NONE)
|
||||
(p/'face.bin').write_bytes(indexed.tobytes());im.save(p/'preview.png')
|
||||
(p/'colors.h').write_text('static UBYTE colors[][3]={'+','.join('{%d,%d,%d}'%c for c in colors)+'};\n')
|
||||
lut=[]
|
||||
for i in range(3600):lut.extend((round(math.sin(i*math.pi/1800)*10000),round(-math.cos(i*math.pi/1800)*10000)))
|
||||
(p/'trig.h').write_text('static short trig[7200]={'+','.join(map(str,lut))+'};\n')
|
||||
atlas=Image.new('1',(96*8,12));a=ImageDraw.Draw(atlas);f=ImageFont.truetype(fontpath,11)
|
||||
for i in range(96):a.text((i*8,0),chr(i+32),font=f,fill=1)
|
||||
(p/'font.bin').write_bytes(bytes(atlas.getpixel((x,y)) for y in range(12) for x in range(768)))
|
||||
Reference in new issue
Block a user