generated from roboDocs/rf-extension-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeSuperpolatorIcon.py
104 lines (79 loc) · 2.73 KB
/
makeSuperpolatorIcon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import os
mm = 643.6
m = 20
size(m,m)
s = m*264/mm # size of the center square
r = m*220/mm # outside circle
rs = m*98/mm # inside circle, "hole"
x = width()*.5-s*.5
y = height()*.5-s*.5
b = BezierPath()
b.rect(x, y, s, s)
b.oval(x-.5*r,y-.5*r, r, r)
b.oval(x-.5*r,y+s-.5*r, r, r)
b.oval(x+s-.5*r,y-.5*r, r, r)
b.oval(x+s-.5*r,y+s-.5*r, r, r)
b.removeOverlap()
b.oval(x-.5*rs,y-.5*rs, rs, rs)
b.oval(x-.5*rs,y+s-.5*rs, rs, rs)
b.oval(x+s-.5*rs,y-.5*rs, rs, rs)
b.oval(x+s-.5*rs,y+s-.5*rs, rs, rs)
# holes = BezierPath()
# holes.oval(x-.5*rs,y-.5*rs, rs, rs)
# holes.oval(x-.5*rs,y+s-.5*rs, rs, rs)
# holes.oval(x+s-.5*rs,y-.5*rs, rs, rs)
# holes.oval(x+s-.5*rs,y+s-.5*rs, rs, rs)
#holes.oval(x+.5*s-.5*rs, y+.5*s-.5*rs, rs, rs )
#p = b.xor(holes)
# gradient locations
#s1 = (width()*.55, height())
#s2 = (width()*0.15, 0)
addName = False
rgb1 = (0.0, 0.7, 1.0)
rgb2 = (0.0, 0.8, 0.2)
versions = [
('_icon', 32, (0.0, 0.6, 1.0), (0.9, 0.7, 0.0), 45),
('_toolbar', 32, (0.1, 0.1, 0.1), (0.1, 0.1, 0.1), 45),
]
#resourcesPath = "/Users/erik/code/superpolator/source/resources"
resourcesPath = "/Users/erik/code/longboardRoboFontExtension/source/resources"
#resourcesPath = os.path.join(os.path.dirname(os.getcwd()), 'extension', 'resources')
mechanicIconPath = "/Users/erik/code/longboardRoboFontExtension/"
for tag, sz, rgb1, rgb2, angle in versions:
aa = angle
a1 = radians(aa)
a2 = radians(aa)+pi
r = width() * 1
c = width()*.5, height()*.5
s1 = c[0] + sin(a1)*r, c[1] + cos(a1)*r
s2 = c[0] + sin(a2)*r, c[1] + cos(a2)*r
gradientData = (s1,
s2,
[rgb1, rgb2], # colors
[.66, .33] )
linearGradient(*gradientData)
print(tag, "linearGradient", gradientData)
drawPath(b)
#fill(1,1,1,0.9)
#drawPath(holes)
namePath = BezierPath()
if addName:
nx = 219
fill(1,1,1,0.98)
fontSize(58)
font("ActionCondBold-Grade3")
namePath.text("Superpolator", (nx, 303), font="ActionCondBold-Grade2", fontSize=73)
#fontSize(17.4)
#font("ActionText-MediumDark")
#namePath.text("Designspaces for Robofont", (nx, 282), font="ActionText-MediumDark", fontSize=14.5)
drawPath(namePath)
if addName:
ext = "_name"
else:
ext = ""
saveImage(os.path.join(resourcesPath, f"longboardIcon{ext}{tag}.png"))
saveImage(os.path.join(resourcesPath, f"longboardIcon{ext}{tag}.pdf"))
#saveImage(os.path.join(resourcesPath, f"superpolator_icon_512{ext}{tag}.pdf"))
print('mechanicIconPath', mechanicIconPath)
saveImage(os.path.join(mechanicIconPath, f"longboardMechanicIcon_{tag}.png"))
saveImage(f"/Users/erik/code/longboardRoboFontExtension/source/html/icon__{tag}.png")