One Flutter client for network-computer: drive a remote Linux/Mac desktop from Android, iPhone, iPad, or desktop over WebRTC.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer-flutter.git
HTTPS
https://gitstable.com/git/askrobots/network-computer-flutter.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer-flutter.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst No colour (compare) in ⋯: the desk's picture in grey on this device c74471a 1 month, 3 weeks ago History
make_icon.py · 3.2 KB · 78 lines
1#!/usr/bin/env python3
2"""Draws the app icon (1024x1024) and writes every iOS size.
3 python3 tool/make_icon.py (needs Pillow)
4A blue screen with a pointer on it, on a dark ground, with two signal arcs:
5a computer you drive from here, over the network. iOS rounds the corners."""
6import os
7from PIL import Image, ImageDraw, ImageFilter
8
9S = 4 * 1024 # draw big, shrink: smooth edges
10BG_TOP, BG_BOTTOM = (22, 30, 48), (8, 10, 16)
11BLUE_TOP, BLUE_BOTTOM = (98, 160, 255), (52, 104, 230)
12WHITE = (255, 255, 255)
13
14
15def lerp(a, b, t):
16 return tuple(round(x + (y - x) * t) for x, y in zip(a, b))
17
18
19def vgradient(size, top, bottom):
20 w, h = size
21 col = Image.new("RGB", (1, h))
22 for y in range(h):
23 col.putpixel((0, y), lerp(top, bottom, y / (h - 1)))
24 return col.resize((w, h))
25
26
27def u(v):
28 return round(v * S / 1024)
29
30
31img = vgradient((S, S), BG_TOP, BG_BOTTOM)
32d = ImageDraw.Draw(img)
33
34# the screen: a filled rounded rectangle with a slightly lighter bezel
35sx0, sy0, sx1, sy1 = u(170), u(250), u(854), u(700)
36glow = Image.new("L", (S, S), 0)
37ImageDraw.Draw(glow).rounded_rectangle((sx0, sy0, sx1, sy1), radius=u(56), fill=150)
38glow = glow.filter(ImageFilter.GaussianBlur(u(60)))
39img.paste(Image.new("RGB", (S, S), (60, 110, 230)), (0, 0), glow)
40d = ImageDraw.Draw(img)
41d.rounded_rectangle((sx0 - u(18), sy0 - u(18), sx1 + u(18), sy1 + u(18)), radius=u(72), fill=(44, 54, 78))
42screen = vgradient((sx1 - sx0, sy1 - sy0), BLUE_TOP, BLUE_BOTTOM)
43mask = Image.new("L", screen.size, 0)
44ImageDraw.Draw(mask).rounded_rectangle((0, 0, screen.size[0] - 1, screen.size[1] - 1), radius=u(48), fill=255)
45img.paste(screen, (sx0, sy0), mask)
46
47# stand
48d.rounded_rectangle((u(462), u(716), u(562), u(792)), radius=u(10), fill=(44, 54, 78))
49d.rounded_rectangle((u(362), u(786), u(662), u(826)), radius=u(20), fill=(44, 54, 78))
50
51# the pointer, white with a soft shadow, a little right of center
52px, py, k = u(470), u(345), u(1)
53arrow = [(0, 0), (0, 250), (62, 196), (108, 296), (152, 276), (108, 180), (190, 180)]
54pts = [(px + x * k, py + y * k) for x, y in arrow]
55shadow = Image.new("L", (S, S), 0)
56ImageDraw.Draw(shadow).polygon([(x + u(10), y + u(14)) for x, y in pts], fill=120)
57shadow = shadow.filter(ImageFilter.GaussianBlur(u(14)))
58img.paste(Image.new("RGB", (S, S), (10, 20, 60)), (0, 0), shadow)
59d = ImageDraw.Draw(img)
60d.polygon(pts, fill=WHITE)
61
62# two signal arcs above the screen's top-right corner
63cx, cy = u(800), u(215)
64for r, wdt in ((u(70), u(26)), (u(130), u(26))):
65 d.arc((cx - r, cy - r, cx + r, cy + r), start=-150, end=-30, fill=(150, 200, 255), width=wdt)
66d.ellipse((cx - u(20), cy - u(20), cx + u(20), cy + u(20)), fill=(150, 200, 255))
67
68icon = img.resize((1024, 1024), Image.LANCZOS)
69here = os.path.dirname(os.path.abspath(__file__))
70out = os.path.join(here, "..", "ios", "Runner", "Assets.xcassets", "AppIcon.appiconset")
71icon.save(os.path.join(here, "icon-1024.png"))
72for name in os.listdir(out):
73 if name.startswith("Icon-App-") and name.endswith(".png"):
74 spec = name[len("Icon-App-"):-4] # e.g. 20x20@3x, 83.5x83.5@2x
75 pt, scale = spec.split("@")
76 px_size = round(float(pt.split("x")[0]) * int(scale[:-1]))
77 icon.resize((px_size, px_size), Image.LANCZOS).save(os.path.join(out, name))
78print("icon written")