Files
Browser/desktop/appimage/make-icon.py
T
Carlo Baratto 577682ae22 Mosaic: motore di rendering proprio, gusci desktop e Sailfish
Primo commit del progetto: motore Rust con parser HTML, cascata CSS, layout,
raster CPU, formulari, bidi, flex, tabelle, JavaScript (Boa) con eventi e
costruzione di nodi, rete HTTP/HTTPS con TLS, sotto-risorse, invio dei
formulari; guscio grafico per Sailfish (QML/Silica) e per desktop (minifb,
distribuito come AppImage), con 11 documenti di specifica e 91 casi di
reftest.
2026-11-12 19:10:26 +01:00

54 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python3
"""Genera l'icona di Mosaic (globo blu/verde) in PNG."""
import sys
from PIL import Image, ImageDraw
size = int(sys.argv[1]) if len(sys.argv) > 1 else 256
out = sys.argv[2] if len(sys.argv) > 2 else "mosaic.png"
S = 4 # sovracampionamento per bordi puliti
W = size * S
img = Image.new("RGBA", (W, W), (0, 0, 0, 0))
d = ImageDraw.Draw(img)
m = W * 0.06
cx = cy = W / 2
r = W / 2 - m
blue = (31, 90, 168, 255)
green = (63, 155, 70, 255)
green_dark = (20, 80, 31, 255)
edge = (0, 0, 0, 255)
grid = (156, 196, 234, 230)
d.ellipse([cx - r, cy - r, cx + r, cy + r], fill=blue, outline=edge, width=max(2, int(W * 0.012)))
def poly(points, fill, outline=None):
pts = [(cx + x * r / 100.0, cy + y * r / 100.0) for x, y in points]
d.polygon(pts, fill=fill)
if outline:
d.line(pts + [pts[0]], fill=outline, width=max(1, int(W * 0.006)))
# continenti stilizzati
poly([(-78, -42), (-46, -58), (-22, -36), (-30, -8), (-62, -6)], green, green_dark)
poly([(-26, 4), (0, 0), (14, 30), (-8, 62), (-28, 30)], green, green_dark)
poly([(4, -46), (54, -40), (62, -6), (26, 4), (10, -22)], green, green_dark)
poly([(18, 16), (44, 24), (34, 48), (16, 40)], green, green_dark)
poly([(-64, 44), (-40, 40), (-44, 58), (-62, 56)], green, green_dark)
# reticolo
w = max(1, int(W * 0.006))
for k in (0.34, 0.66):
rr = r * k
d.ellipse([cx - r, cy - rr, cx + r, cy + rr], outline=grid, width=w)
d.ellipse([cx - r * 0.35, cy - r, cx + r * 0.35, cy + r], outline=grid, width=w)
d.line([cx, cy - r, cx, cy + r], fill=grid, width=w)
d.line([cx - r, cy, cx + r, cy], fill=grid, width=w)
# luce
img = img.resize((size, size), Image.LANCZOS)
img.save(out)
print("icona:", out, size)