harbour-maree 0.1.0: motore armonico 7 costituenti, 16 porti, ricerca libera (Nominatim+locale), grafico 24/48/72h, EN/IT, preferenze (lingua, porto, unità, intervallo), icone harbour
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Genera le icone dell'app in stile Sailfish OS:
|
||||
sfondo a gradiente azzurro->blu con angoli molto arrotondati,
|
||||
due onde bianche (marea) con ombra morbida e una luna in alto.
|
||||
Dimensioni: 86, 108, 128, 172 (struttura standard hicolor)."""
|
||||
import math
|
||||
import os
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
# gradiente Sailfish: azzurro chiaro (alto) -> blu profondo (basso)
|
||||
C_TOP = (94, 210, 240) # #5ED2F0
|
||||
C_BOT = (14, 111, 168) # #0E6FA8
|
||||
WAVE1 = (255, 255, 255) # onda principale, bianca piena
|
||||
WAVE2 = (255, 255, 255) # onda secondaria, semitrasparente
|
||||
MOON = (255, 255, 255)
|
||||
|
||||
|
||||
def gradient(size, c1, c2):
|
||||
img = Image.new("RGB", (size, size))
|
||||
d = ImageDraw.Draw(img)
|
||||
for y in range(size):
|
||||
t = y / (size - 1)
|
||||
d.line([(0, y), (size, y)],
|
||||
fill=(int(c1[0] + (c2[0] - c1[0]) * t),
|
||||
int(c1[1] + (c2[1] - c1[1]) * t),
|
||||
int(c1[2] + (c2[2] - c1[2]) * t)))
|
||||
return img
|
||||
|
||||
|
||||
def wave_layer(size, y0, amp, phase, lw, alpha):
|
||||
"""Layer RGBA con una sinusoide orizzontale (onda)."""
|
||||
layer = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(layer)
|
||||
pts = []
|
||||
for x in range(0, size + 2, 2):
|
||||
y = y0 + amp * math.sin(2 * math.pi * x / size * 1.6 + phase)
|
||||
pts.append((x, y))
|
||||
d.line(pts, fill=WAVE1 + (alpha,), width=lw)
|
||||
return layer
|
||||
|
||||
|
||||
def draw_icon(size):
|
||||
m = size * 0.05
|
||||
r = size * 0.22
|
||||
out = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||||
|
||||
# sfondo: gradiente ritagliato nel rounded rect
|
||||
grad = gradient(size, C_TOP, C_BOT).convert("RGBA")
|
||||
mask = Image.new("L", (size, size), 0)
|
||||
ImageDraw.Draw(mask).rounded_rectangle([m, m, size - m, size - m],
|
||||
radius=r, fill=255)
|
||||
out.paste(grad, (0, 0), mask)
|
||||
|
||||
# onde: due sinusoidi, la seconda sfasata e piu' bassa
|
||||
lw1 = max(2, int(size * 0.045))
|
||||
lw2 = max(2, int(size * 0.032))
|
||||
out.alpha_composite(wave_layer(size, size * 0.58, size * 0.07, 0.0, lw1, 255))
|
||||
out.alpha_composite(wave_layer(size, size * 0.74, size * 0.06, math.pi, lw2, 150))
|
||||
|
||||
# luna in alto a destra (cerchio pieno, con ombra leggera)
|
||||
d = ImageDraw.Draw(out)
|
||||
lx = size * 0.78
|
||||
ly = size * 0.22
|
||||
lr = size * 0.09
|
||||
d.ellipse([lx - lr + size * 0.01, ly - lr + size * 0.01,
|
||||
lx + lr + size * 0.01, ly + lr + size * 0.01],
|
||||
fill=(0, 60, 100, 70))
|
||||
d.ellipse([lx - lr, ly - lr, lx + lr, ly + lr], fill=MOON)
|
||||
return out
|
||||
|
||||
|
||||
def main():
|
||||
for s in (86, 108, 128, 172):
|
||||
os.makedirs(f"icons/{s}x{s}", exist_ok=True)
|
||||
draw_icon(s).save(f"icons/{s}x{s}/harbour-maree.png")
|
||||
print("icone scritte: 86, 108, 128, 172")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user