#!/usr/bin/env python3 """화면 UI 아이콘 모음(1024x1024, 128px 칸 8x8)을 직접 그립니다. 외부 그림을 쓰지 않습니다. 로블록스에는 이 한 장만 올리고, 각 아이콘은 ImageRectOffset/ImageRectSize로 잘라 씁니다. 칸 이름과 위치는 src/shared/Icons.luau 와 같아야 합니다(tools/icons.py --luau 로 확인). python3 tools/icons.py # art/ui_icons.png python3 tools/icons.py --sheet x.png # 이름표가 붙은 확인용 그림 """ import math import os import sys import cairo OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "art", "ui_icons.png") CELL = 128 GRID = 8 INK = (0.23, 0.12, 0.07) # 테두리(진한 갈색) LW = 7 # 테두리 굵기 def rgb(h): h = h.lstrip("#") return tuple(int(h[i:i + 2], 16) / 255 for i in (0, 2, 4)) def lin(x0, y0, x1, y1, *stops): g = cairo.LinearGradient(x0, y0, x1, y1) for i, c in enumerate(stops): g.add_color_stop_rgb(i / max(1, len(stops) - 1), *rgb(c)) return g def rad(cx, cy, r, *stops): g = cairo.RadialGradient(cx - r * 0.3, cy - r * 0.35, r * 0.1, cx, cy, r) for i, c in enumerate(stops): g.add_color_stop_rgb(i / max(1, len(stops) - 1), *rgb(c)) return g def fill_stroke(c, paint, lw=LW): c.set_source(paint) if isinstance(paint, cairo.Pattern) else c.set_source_rgb(*paint) c.fill_preserve() c.set_source_rgb(*INK) c.set_line_width(lw) c.set_line_join(cairo.LINE_JOIN_ROUND) c.set_line_cap(cairo.LINE_CAP_ROUND) c.stroke() def rrect(c, x, y, w, h, r): c.new_sub_path() c.arc(x + w - r, y + r, r, -math.pi / 2, 0) c.arc(x + w - r, y + h - r, r, 0, math.pi / 2) c.arc(x + r, y + h - r, r, math.pi / 2, math.pi) c.arc(x + r, y + r, r, math.pi, 3 * math.pi / 2) c.close_path() def shine(c, x, y, w, h, alpha=0.55): """왼쪽 위 흰 반사광(타원 조각).""" c.save() c.translate(x, y) c.scale(w, h) c.arc(0, 0, 1, 0, 2 * math.pi) c.restore() c.set_source_rgba(1, 1, 1, alpha) c.fill() def polygon(c, pts): c.move_to(*pts[0]) for p in pts[1:]: c.line_to(*p) c.close_path() def star_pts(cx, cy, r1, r2, n=5, rot=-math.pi / 2): pts = [] for i in range(n * 2): r = r1 if i % 2 == 0 else r2 a = rot + i * math.pi / n pts.append((cx + r * math.cos(a), cy + r * math.sin(a))) return pts # ---------------------------------------------------------------- 아이콘들 (64x64 중심, 128 칸) def coin(c): c.arc(64, 66, 50, 0, 2 * math.pi) fill_stroke(c, rad(64, 66, 56, "#fff3a0", "#ffd23a", "#f59e0b")) c.arc(64, 66, 36, 0, 2 * math.pi) c.set_source(lin(0, 30, 0, 100, "#f5a70b", "#ffd84a")) c.fill_preserve() c.set_source_rgba(*INK, 0.35) c.set_line_width(3) c.stroke() # ₩ c.set_source_rgb(*rgb("#b45309")) c.set_line_width(8) c.set_line_cap(cairo.LINE_CAP_ROUND) c.set_line_join(cairo.LINE_JOIN_ROUND) c.move_to(44, 47) c.line_to(53, 87) c.line_to(64, 57) c.line_to(75, 87) c.line_to(84, 47) c.stroke() c.set_line_width(5) for y in (64, 74): c.move_to(41, y) c.line_to(87, y) c.stroke() shine(c, 44, 40, 14, 8, 0.7) def money_bag(c): c.move_to(46, 30) c.curve_to(30, 50, 14, 74, 22, 96) c.curve_to(28, 116, 100, 116, 106, 96) c.curve_to(114, 74, 98, 50, 82, 30) c.close_path() fill_stroke(c, rad(64, 76, 56, "#c7f59a", "#6cc63c", "#3f8f25")) rrect(c, 42, 16, 44, 18, 8) fill_stroke(c, lin(0, 16, 0, 34, "#a5e57a", "#4f9f2c")) c.set_source_rgb(*rgb("#ffd23a")) c.set_line_width(7) c.move_to(44, 36) c.line_to(84, 36) c.stroke() # ₩ 표시 c.set_source_rgb(*rgb("#2f6f17")) c.set_line_width(7) c.set_line_cap(cairo.LINE_CAP_ROUND) c.move_to(46, 62) c.line_to(54, 94) c.line_to(64, 70) c.line_to(74, 94) c.line_to(82, 62) c.stroke() c.set_line_width(4) c.move_to(43, 76) c.line_to(85, 76) c.stroke() shine(c, 40, 62, 8, 14, 0.5) def bolt(c): polygon(c, [(74, 8), (26, 72), (58, 72), (48, 120), (102, 50), (68, 50), (82, 8)]) fill_stroke(c, lin(30, 10, 90, 120, "#fff6a8", "#ffd21f", "#ff9f0a")) polygon(c, [(72, 18), (40, 64), (52, 64)]) c.set_source_rgba(1, 1, 1, 0.6) c.fill() def gear(c): teeth = 8 pts = [] for i in range(teeth * 4): a = i * 2 * math.pi / (teeth * 4) - math.pi / 2 r = 54 if (i % 4) in (0, 1) else 40 pts.append((64 + r * math.cos(a + math.pi / (teeth * 4)), 64 + r * math.sin(a + math.pi / (teeth * 4)))) polygon(c, pts) c.new_sub_path() c.arc_negative(64, 64, 17, 0, -2 * math.pi) c.set_fill_rule(cairo.FILL_RULE_EVEN_ODD) fill_stroke(c, rad(64, 64, 58, "#f1f5f9", "#a8b4c4", "#64748b")) c.set_fill_rule(cairo.FILL_RULE_WINDING) shine(c, 46, 42, 10, 6, 0.6) def upgrade(c): # 초록 위쪽 화살표 polygon(c, [(64, 8), (114, 60), (84, 60), (84, 116), (44, 116), (44, 60), (14, 60)]) fill_stroke(c, lin(0, 8, 0, 116, "#b6f774", "#46c937", "#178a2c")) polygon(c, [(64, 22), (34, 54), (50, 54)]) c.set_source_rgba(1, 1, 1, 0.55) c.fill() def plate(c): c.save() c.translate(64, 76) c.scale(1, 0.5) c.arc(0, 0, 56, 0, 2 * math.pi) c.restore() fill_stroke(c, lin(0, 50, 0, 104, "#ffffff", "#d7dde6")) c.save() c.translate(64, 74) c.scale(1, 0.5) c.arc(0, 0, 36, 0, 2 * math.pi) c.restore() c.set_source_rgba(*INK, 0.25) c.set_line_width(3) c.stroke() # 김 나는 음식 c.move_to(36, 72) c.curve_to(36, 36, 92, 36, 92, 72) c.close_path() fill_stroke(c, lin(0, 40, 0, 72, "#ff7a59", "#e63b1f")) for x in (52, 64, 76): c.move_to(x, 30) c.curve_to(x - 6, 22, x + 6, 16, x, 8) c.set_source_rgba(1, 1, 1, 0.9) c.set_line_width(4) c.stroke() def lock(c): c.arc(64, 50, 26, math.pi, 2 * math.pi) c.set_line_width(14 + LW) c.set_source_rgb(*INK) c.stroke() c.arc(64, 50, 26, math.pi, 2 * math.pi) c.set_line_width(13) c.set_source_rgb(*rgb("#cbd5e1")) c.stroke() rrect(c, 26, 50, 76, 64, 14) fill_stroke(c, lin(0, 50, 0, 114, "#ffe066", "#f59e0b")) c.arc(64, 76, 9, 0, 2 * math.pi) c.set_source_rgb(*INK) c.fill() rrect(c, 60, 78, 8, 20, 4) c.fill() def check(c): c.set_line_cap(cairo.LINE_CAP_ROUND) c.set_line_join(cairo.LINE_JOIN_ROUND) for w, col in ((30, INK), (18, rgb("#4ade80"))): c.move_to(22, 66) c.line_to(52, 96) c.line_to(106, 34) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() def close_x(c): c.set_line_cap(cairo.LINE_CAP_ROUND) for w, col in ((32, INK), (19, (1, 1, 1))): c.set_line_width(w) c.set_source_rgb(*col) c.move_to(30, 30) c.line_to(98, 98) c.move_to(98, 30) c.line_to(30, 98) c.stroke() def table(c): # 다리 for x in (30, 92): rrect(c, x, 58, 12, 56, 4) fill_stroke(c, lin(0, 58, 0, 114, "#b9763c", "#7a4a22"), 5) c.save() c.translate(64, 52) c.scale(1, 0.42) c.arc(0, 0, 58, 0, 2 * math.pi) c.restore() fill_stroke(c, lin(0, 28, 0, 76, "#f2b46b", "#c97b36")) c.save() c.translate(64, 50) c.scale(1, 0.42) c.arc(0, 0, 42, 0, 2 * math.pi) c.restore() c.set_source_rgba(1, 1, 1, 0.3) c.fill() def sign(c): for x in (34, 90): rrect(c, x, 70, 8, 50, 3) fill_stroke(c, rgb("#7a4a22"), 5) rrect(c, 10, 16, 108, 64, 14) fill_stroke(c, lin(0, 16, 0, 80, "#ff6b4a", "#d92f1c")) rrect(c, 20, 26, 88, 44, 8) c.set_source_rgb(*rgb("#fff3d6")) c.fill() for i, x in enumerate((40, 64, 88)): polygon(c, star_pts(x, 48, 13, 6)) fill_stroke(c, rgb("#ffc61a"), 3) def flame(c): c.move_to(64, 6) c.curve_to(96, 40, 112, 62, 108, 86) c.curve_to(104, 112, 84, 122, 64, 122) c.curve_to(40, 122, 20, 108, 20, 84) c.curve_to(20, 64, 34, 52, 40, 34) c.curve_to(48, 50, 52, 54, 56, 56) c.curve_to(56, 36, 58, 22, 64, 6) c.close_path() fill_stroke(c, lin(0, 6, 0, 122, "#ffd23a", "#ff7a1a", "#e8341c")) c.move_to(64, 58) c.curve_to(82, 76, 88, 88, 84, 100) c.curve_to(80, 114, 48, 114, 44, 100) c.curve_to(42, 88, 54, 78, 64, 58) c.close_path() c.set_source(lin(0, 58, 0, 114, "#fff8c2", "#ffd23a")) c.fill() def sauce(c): rrect(c, 52, 6, 24, 20, 6) fill_stroke(c, rgb("#ffffff"), 5) c.move_to(48, 26) c.line_to(80, 26) c.curve_to(80, 40, 100, 44, 100, 64) c.line_to(100, 108) c.curve_to(100, 118, 94, 122, 86, 122) c.line_to(42, 122) c.curve_to(34, 122, 28, 118, 28, 108) c.line_to(28, 64) c.curve_to(28, 44, 48, 40, 48, 26) c.close_path() fill_stroke(c, lin(28, 0, 100, 0, "#ff5a3c", "#d61f12", "#a8150b")) rrect(c, 38, 66, 52, 36, 8) c.set_source_rgb(*rgb("#fff3d6")) c.fill() polygon(c, [(64, 72), (72, 84), (64, 96), (56, 84)]) c.set_source_rgb(*rgb("#e8341c")) c.fill() c.rectangle(36, 46, 8, 52) c.set_source_rgba(1, 1, 1, 0.45) c.fill() def chef(c): # 요리사 모자 for x, y, r in ((40, 46, 24), (64, 34, 28), (88, 46, 24)): c.arc(x, y, r, 0, 2 * math.pi) c.set_source_rgb(*INK) c.fill() rrect(c, 34, 56, 60, 52, 8) fill_stroke(c, lin(0, 56, 0, 108, "#ffffff", "#dfe5ee")) for x, y, r in ((40, 46, 24 - LW / 2), (64, 34, 28 - LW / 2), (88, 46, 24 - LW / 2)): c.arc(x, y, r, 0, 2 * math.pi) c.set_source(rad(x, y, r + 4, "#ffffff", "#e6ebf2")) c.fill() rrect(c, 34 + LW / 2, 60, 60 - LW, 20, 4) c.set_source_rgb(1, 1, 1) c.fill() for x in (52, 64, 76): c.move_to(x, 86) c.line_to(x, 104) c.set_source_rgba(*INK, 0.3) c.set_line_width(3) c.stroke() def store(c): rrect(c, 18, 54, 92, 64, 6) fill_stroke(c, lin(0, 54, 0, 118, "#fff3d6", "#f2d7a8")) # 줄무늬 차양 polygon(c, [(10, 56), (22, 18), (106, 18), (118, 56)]) c.set_source_rgb(*INK) c.set_line_width(LW) c.stroke_preserve() c.save() c.clip() for i in range(7): polygon(c, [(10 + i * 18, 56), (22 + i * 12, 18), (34 + i * 12, 18), (28 + i * 18, 56)]) c.set_source_rgb(*(rgb("#e8341c") if i % 2 == 0 else (1, 1, 1))) c.fill() c.restore() polygon(c, [(10, 56), (22, 18), (106, 18), (118, 56)]) c.set_source_rgb(*INK) c.set_line_width(LW) c.stroke() rrect(c, 52, 76, 24, 42, 4) fill_stroke(c, rgb("#b9763c"), 5) rrect(c, 26, 70, 18, 18, 3) fill_stroke(c, rgb("#8fd3ff"), 4) rrect(c, 84, 70, 18, 18, 3) fill_stroke(c, rgb("#8fd3ff"), 4) def tray(c): polygon(c, [(8, 70), (120, 70), (108, 98), (20, 98)]) fill_stroke(c, lin(0, 70, 0, 98, "#e2e8f0", "#94a3b8")) for x, col in ((40, "#ff6b4a"), (64, "#ffd23a"), (88, "#7dd36b")): c.move_to(x - 16, 68) c.curve_to(x - 16, 44, x + 16, 44, x + 16, 68) c.close_path() fill_stroke(c, rgb(col), 5) shine(c, 30, 80, 14, 4, 0.6) def tteokbokki(c): # 그릇 c.move_to(10, 58) c.line_to(118, 58) c.curve_to(116, 96, 92, 118, 64, 118) c.curve_to(36, 118, 12, 96, 10, 58) c.close_path() fill_stroke(c, lin(0, 58, 0, 118, "#ffffff", "#cfd8e3")) # 소스 c.save() c.translate(64, 58) c.scale(1, 0.32) c.arc(0, 0, 52, 0, 2 * math.pi) c.restore() c.set_source_rgb(*rgb("#e8341c")) c.fill() # 떡 for x, y, a in ((40, 46, -0.5), (64, 40, 0.3), (86, 48, -0.2), (54, 56, 0.1), (78, 58, -0.4)): c.save() c.translate(x, y) c.rotate(a) rrect(c, -16, -8, 32, 16, 8) c.restore() fill_stroke(c, lin(0, y - 8, 0, y + 8, "#ff8a6a", "#d92f1c"), 4) c.save() c.translate(x, y) c.rotate(a) rrect(c, -10, -5, 14, 4, 2) c.restore() c.set_source_rgba(1, 1, 1, 0.6) c.fill() shine(c, 26, 80, 6, 12, 0.5) def gimbap(c): for x, y in ((40, 74), (88, 74), (64, 50)): c.arc(x, y, 26, 0, 2 * math.pi) fill_stroke(c, rgb("#1f2a1f"), 5) c.arc(x, y, 19, 0, 2 * math.pi) c.set_source_rgb(1, 1, 1) c.fill() for dx, dy, col in ((-6, -5, "#ff8c1a"), (6, -4, "#ffd23a"), (0, 6, "#4caf50"), (-7, 6, "#e8341c")): c.arc(x + dx, y + dy, 5, 0, 2 * math.pi) c.set_source_rgb(*rgb(col)) c.fill() def sundae(c): for x, y in ((38, 80), (64, 60), (90, 80)): c.arc(x, y, 26, 0, 2 * math.pi) fill_stroke(c, rad(x, y, 30, "#8a5a6a", "#5a2e3c", "#3a1a24"), 5) for dx, dy in ((-8, -6), (6, -8), (8, 6), (-6, 8), (0, 0)): c.arc(x + dx, y + dy, 3, 0, 2 * math.pi) c.set_source_rgba(1, 0.85, 0.8, 0.7) c.fill() def eomuk(c): c.set_line_cap(cairo.LINE_CAP_ROUND) for w, col in ((10 + LW, INK), (8, rgb("#e8c58f"))): c.move_to(64, 6) c.line_to(64, 124) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() # 꼬치에 접어 꽂은 어묵(지그재그 세 겹) for i, (dx, a) in enumerate(((-8, -0.12), (8, 0.12), (-8, -0.12))): y = 30 + i * 28 c.save() c.translate(64 + dx, y) c.rotate(a) rrect(c, -40, -14, 80, 28, 12) c.restore() fill_stroke(c, lin(0, y - 14, 0, y + 14, "#ffe2a8", "#f2b46b", "#d98a3a"), 6) c.save() c.translate(64 + dx, y) c.rotate(a) rrect(c, -32, -9, 40, 5, 2.5) c.restore() c.set_source_rgba(1, 1, 1, 0.55) c.fill() def twigim(c): # 새우튀김 c.save() c.translate(64, 64) c.rotate(-0.7) c.move_to(-52, 0) c.curve_to(-52, -26, 30, -26, 40, -6) c.line_to(40, 6) c.curve_to(30, 26, -52, 26, -52, 0) c.close_path() c.restore() fill_stroke(c, lin(20, 20, 110, 110, "#ffe28a", "#f5a524", "#c9761a")) c.save() c.translate(64, 64) c.rotate(-0.7) polygon(c, [(38, -2), (60, -18), (54, 0), (60, 18), (38, 2)]) c.restore() fill_stroke(c, rgb("#ff6b4a"), 5) for x, y in ((40, 74), (54, 62), (68, 50), (48, 86), (62, 74), (76, 62), (34, 62)): c.arc(x, y, 3.5, 0, 2 * math.pi) c.set_source_rgba(1, 1, 1, 0.55) c.fill() def globe(c): c.arc(64, 64, 52, 0, 2 * math.pi) fill_stroke(c, rad(64, 64, 58, "#a8e6ff", "#38a8f5", "#1769c4")) c.save() c.arc(64, 64, 52 - LW / 2, 0, 2 * math.pi) c.clip() c.set_source(lin(0, 0, 0, 128, "#86e06a", "#3fa33a")) c.move_to(30, 30) c.curve_to(50, 20, 60, 40, 52, 56) c.curve_to(44, 70, 22, 64, 18, 52) c.close_path() c.fill() c.move_to(70, 60) c.curve_to(94, 50, 112, 70, 100, 92) c.curve_to(90, 108, 70, 100, 72, 84) c.close_path() c.fill() c.restore() c.set_source_rgba(*INK, 0.35) c.set_line_width(3) c.save() c.translate(64, 64) c.scale(0.45, 1) c.arc(0, 0, 52, 0, 2 * math.pi) c.restore() c.stroke() c.move_to(12, 64) c.line_to(116, 64) c.stroke() shine(c, 44, 40, 12, 8, 0.6) def speaker(c): polygon(c, [(14, 48), (38, 48), (68, 20), (68, 108), (38, 80), (14, 80)]) fill_stroke(c, lin(0, 20, 0, 108, "#ffe066", "#f59e0b")) c.set_line_cap(cairo.LINE_CAP_ROUND) for r in (22, 40): for w, col in ((9 + LW, INK), (9, (1, 1, 1))): c.arc(70, 64, r, -0.8, 0.8) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() def mouse(c): rrect(c, 32, 14, 64, 100, 32) fill_stroke(c, lin(32, 0, 96, 0, "#ffffff", "#cbd5e1")) c.move_to(64, 16) c.line_to(64, 52) c.move_to(34, 52) c.line_to(94, 52) c.set_source_rgb(*INK) c.set_line_width(5) c.stroke() rrect(c, 59, 28, 10, 18, 5) c.set_source_rgb(*rgb("#38a8f5")) c.fill() def wrench(c): c.save() c.translate(64, 64) c.rotate(-math.pi / 4) rrect(c, -11, -6, 22, 66, 11) c.restore() fill_stroke(c, lin(0, 0, 128, 128, "#e2e8f0", "#7b8796")) cx, cy, r, d = 46, 46, 30, -3 * math.pi / 4 def u(a, k): return cx + k * math.cos(a), cy + k * math.sin(a) c.new_sub_path() c.arc(cx, cy, r, d + 0.5, d - 0.5 + 2 * math.pi) c.line_to(*u(d - 0.75, 12)) c.line_to(*u(d + 0.75, 12)) c.close_path() fill_stroke(c, rad(cx, cy, r + 2, "#f1f5f9", "#94a3b8")) def star(c): polygon(c, star_pts(64, 68, 58, 26)) fill_stroke(c, lin(0, 10, 0, 120, "#fff6a8", "#ffd21f", "#ff9f0a")) polygon(c, star_pts(56, 56, 16, 7)) c.set_source_rgba(1, 1, 1, 0.55) c.fill() def sparkle(c): # 테두리 없는 반짝이(흰색, 버튼·카드 위 장식) pts = star_pts(64, 64, 60, 12, n=4) polygon(c, pts) g = cairo.RadialGradient(64, 64, 4, 64, 64, 60) g.add_color_stop_rgba(0, 1, 1, 1, 1) g.add_color_stop_rgba(1, 1, 1, 0.85, 0.9) c.set_source(g) c.fill() def rays(c): # 햇살(흰색, 테두리 없음). 2배·부스트 버튼 뒤에서 천천히 돕니다. g = cairo.RadialGradient(64, 64, 6, 64, 64, 64) g.add_color_stop_rgba(0, 1, 1, 1, 1) g.add_color_stop_rgba(0.6, 1, 1, 1, 0.55) g.add_color_stop_rgba(1, 1, 1, 1, 0) for i in range(12): a0 = i * math.pi / 6 a1 = a0 + math.pi / 12 c.move_to(64, 64) c.line_to(64 + 90 * math.cos(a0), 64 + 90 * math.sin(a0)) c.line_to(64 + 90 * math.cos(a1), 64 + 90 * math.sin(a1)) c.close_path() c.set_source(g) c.fill() def glow(c): # 둥근 빛(흰색). 버튼 뒤 후광·알림 빛 g = cairo.RadialGradient(64, 64, 0, 64, 64, 64) g.add_color_stop_rgba(0, 1, 1, 1, 1) g.add_color_stop_rgba(0.45, 1, 1, 1, 0.6) g.add_color_stop_rgba(1, 1, 1, 1, 0) c.rectangle(0, 0, 128, 128) c.set_source(g) c.fill() def arrow_down(c): polygon(c, [(40, 8), (88, 8), (88, 64), (114, 64), (64, 120), (14, 64), (40, 64)]) fill_stroke(c, lin(0, 8, 0, 120, "#fff6a8", "#ffd21f", "#ff8a0a")) c.rectangle(48, 16, 10, 44) c.set_source_rgba(1, 1, 1, 0.55) c.fill() def scroll(c): # 업그레이드 목록(두루마리 메뉴판) rrect(c, 24, 14, 80, 100, 10) fill_stroke(c, lin(0, 14, 0, 114, "#fff8e6", "#f2d7a8")) for y in (38, 58, 78): c.arc(40, y, 6, 0, 2 * math.pi) c.set_source_rgb(*rgb("#e8341c")) c.fill() rrect(c, 52, y - 4, 38, 8, 4) c.set_source_rgba(*INK, 0.55) c.fill() rrect(c, 16, 98, 96, 22, 11) fill_stroke(c, lin(0, 98, 0, 120, "#ff8a5a", "#d92f1c"), 6) def hand(c): # 누르는 손가락(튜토리얼) c.move_to(50, 18) c.curve_to(50, 6, 70, 6, 70, 18) c.line_to(70, 56) c.curve_to(92, 52, 110, 58, 110, 76) c.line_to(108, 98) c.curve_to(106, 116, 90, 122, 72, 122) c.curve_to(54, 122, 42, 114, 34, 100) c.line_to(20, 76) c.curve_to(14, 64, 30, 58, 38, 68) c.line_to(50, 80) c.close_path() fill_stroke(c, lin(0, 6, 0, 122, "#ffe9d0", "#f5c89a")) ICONS = [ ("coin", coin), ("moneyBag", money_bag), ("bolt", bolt), ("gear", gear), ("upgrade", upgrade), ("plate", plate), ("lock", lock), ("check", check), ("close", close_x), ("table", table), ("sign", sign), ("flame", flame), ("sauce", sauce), ("chef", chef), ("store", store), ("tray", tray), ("Tteokbokki", tteokbokki), ("Gimbap", gimbap), ("Sundae", sundae), ("Eomuk", eomuk), ("Twigim", twigim), ("globe", globe), ("speaker", speaker), ("mouse", mouse), ("wrench", wrench), ("star", star), ("sparkle", sparkle), ("rays", rays), ("glow", glow), ("arrowDown", arrow_down), ("scroll", scroll), ("hand", hand), ] def draw(): surf = cairo.ImageSurface(cairo.FORMAT_ARGB32, CELL * GRID, CELL * GRID) for i, (name, fn) in enumerate(ICONS): c = cairo.Context(surf) c.translate((i % GRID) * CELL, (i // GRID) * CELL) c.rectangle(0, 0, CELL, CELL) c.clip() # 테두리가 칸 밖으로 안 나가게 살짝 줄입니다. c.translate(64, 64) c.scale(0.9, 0.9) c.translate(-64, -64) fn(c) return surf def main(argv): surf = draw() if "--luau" in argv: for i, (name, _) in enumerate(ICONS): print(f"\t{name} = Vector2.new({(i % GRID) * CELL}, {(i // GRID) * CELL}),") return if "--sheet" in argv: out = argv[argv.index("--sheet") + 1] rows = (len(ICONS) + GRID - 1) // GRID sheet = cairo.ImageSurface(cairo.FORMAT_ARGB32, CELL * GRID, (CELL + 20) * rows) c = cairo.Context(sheet) c.set_source_rgb(0.55, 0.75, 0.6) c.paint() for i, (name, _) in enumerate(ICONS): x, y = (i % GRID) * CELL, (i // GRID) * (CELL + 20) c.set_source_surface(surf, x - (i % GRID) * CELL + 0, y - (i // GRID) * CELL) c.rectangle(x, y, CELL, CELL) c.fill() c.set_source_rgb(0, 0, 0) c.move_to(x + 4, y + CELL + 15) c.set_font_size(13) c.show_text(name) sheet.write_to_png(out) print(out) return surf.write_to_png(OUT) print(os.path.normpath(OUT)) if __name__ == "__main__": main(sys.argv[1:])