#!/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")) # ---------------------------------------------------------------- 요리 화면 재료·도구 (칸 32~63) def ellipse(c, cx, cy, rx, ry): c.save() c.translate(cx, cy) c.scale(rx, ry) c.arc(0, 0, 1, 0, 2 * math.pi) c.restore() def bowl(c, top, inner, lw=LW): """옆에서 본 둥근 그릇. inner: 그릇 안 음식 색(위쪽 타원).""" c.move_to(12, 60) c.line_to(116, 60) c.curve_to(114, 98, 92, 116, 64, 116) c.curve_to(36, 116, 14, 98, 12, 60) c.close_path() fill_stroke(c, lin(0, 60, 0, 116, *top), lw) ellipse(c, 64, 60, 52, 14) fill_stroke(c, rgb(inner), 5) def rice_cake(c): # 떡 한 개(가로) rrect(c, 14, 44, 100, 40, 20) fill_stroke(c, lin(0, 44, 0, 84, "#fff8ee", "#f3e3cc")) rrect(c, 26, 52, 44, 8, 4) c.set_source_rgba(1, 1, 1, 0.9) c.fill() def rice_cake_red(c): # 양념 묻은 떡 rrect(c, 14, 44, 100, 40, 20) fill_stroke(c, lin(0, 44, 0, 84, "#ff8a6a", "#d92f1c")) rrect(c, 26, 52, 44, 8, 4) c.set_source_rgba(1, 1, 1, 0.6) c.fill() def rice_cakes(c): # 떡이 담긴 그릇(누르는 도구) for x, y, a in ((42, 46, -0.5), (64, 36, 0.2), (86, 46, 0.5), (54, 52, 0.1), (76, 54, -0.3)): c.save() c.translate(x, y) c.rotate(a) rrect(c, -18, -8, 36, 16, 8) c.restore() fill_stroke(c, lin(0, y - 8, 0, y + 8, "#ffffff", "#efdcc2"), 4) bowl(c, ("#8fd3ff", "#3b82f6"), "#f3e3cc") shine(c, 30, 84, 6, 12, 0.5) def sauce_bowl(c): # 고추장 양념 그릇 + 숟가락 c.set_line_cap(cairo.LINE_CAP_ROUND) for w, col in ((14 + LW, INK), (12, rgb("#e2e8f0"))): c.move_to(78, 54) c.line_to(110, 10) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() bowl(c, ("#ffffff", "#cbd5e1"), "#e8341c") shine(c, 40, 56, 14, 4, 0.5) shine(c, 30, 84, 6, 12, 0.5) def sauce_blob(c): # 팬에 부은 빨간 양념(넓은 타원, 테두리 없음) ellipse(c, 64, 64, 62, 46) c.set_source(rad(64, 64, 64, "#ff6a4a", "#e8341c", "#c41e10")) c.fill() for x, y, r in ((40, 50, 6), (80, 70, 5), (60, 84, 4), (90, 46, 4)): c.arc(x, y, r, 0, 2 * math.pi) c.set_source_rgba(1, 0.8, 0.7, 0.55) c.fill() def spatula(c): # 볶음 주걱(대각선) c.save() c.translate(64, 64) c.rotate(-0.75) rrect(c, -6, -10, 12, 72, 6) fill_stroke(c, lin(-6, 0, 6, 0, "#e0a96d", "#a8662e"), 5) rrect(c, -22, -60, 44, 54, 14) fill_stroke(c, lin(0, -60, 0, -6, "#fff3c4", "#ffb84a"), 6) for dx in (-8, 0, 8): rrect(c, dx - 2, -50, 4, 30, 2) c.set_source_rgba(*INK, 0.35) c.fill() c.restore() def bubble(c): c.arc(64, 64, 40, 0, 2 * math.pi) c.set_source_rgba(1, 1, 1, 0.35) c.fill_preserve() c.set_source_rgba(1, 1, 1, 0.95) c.set_line_width(8) c.stroke() shine(c, 50, 48, 10, 7, 0.9) def steam(c): c.set_line_cap(cairo.LINE_CAP_ROUND) for w, col in ((18, (0.62, 0.72, 0.85, 0.8)), (11, (1, 1, 1, 1))): for x in (34, 64, 94): c.move_to(x, 118) c.curve_to(x - 22, 92, x + 22, 70, x, 44) c.curve_to(x - 14, 30, x + 10, 18, x, 8) c.set_source_rgba(*col) c.set_line_width(w) c.stroke() def fillings(c): # 김밥 재료 쟁반(단무지·당근·시금치·달걀·햄) rrect(c, 8, 70, 112, 40, 14) fill_stroke(c, lin(0, 70, 0, 110, "#ffe9c7", "#e6b77a")) for i, col in enumerate(("#ffe14a", "#ff8c1a", "#3fae49", "#fff3a0", "#ff8fa3")): x = 18 + i * 20 rrect(c, x, 22 + (i % 2) * 8, 14, 62, 7) fill_stroke(c, rgb(col), 4) def mat(c): # 김발(대나무 말이) rrect(c, 10, 22, 108, 84, 10) fill_stroke(c, lin(0, 22, 0, 106, "#d9f2a4", "#94c25a")) for i in range(1, 9): x = 10 + i * 12 c.move_to(x, 26) c.line_to(x, 102) c.set_source_rgba(*INK, 0.35) c.set_line_width(3) c.stroke() shine(c, 30, 36, 12, 6, 0.6) def knife(c): c.save() c.translate(64, 64) c.rotate(-0.6) rrect(c, -10, 18, 20, 44, 8) fill_stroke(c, lin(-10, 0, 10, 0, "#7c4a24", "#4a2a12"), 5) c.move_to(-14, 20) c.line_to(-14, -46) c.curve_to(-14, -60, 4, -64, 16, -52) c.line_to(16, 20) c.close_path() fill_stroke(c, lin(-14, 0, 16, 0, "#ffffff", "#cbd5e1", "#94a3b8"), 6) rrect(c, -8, -44, 6, 50, 3) c.set_source_rgba(1, 1, 1, 0.8) c.fill() c.restore() def gimbap_slice(c): c.arc(64, 64, 52, 0, 2 * math.pi) fill_stroke(c, rgb("#1f2a1f")) c.arc(64, 64, 40, 0, 2 * math.pi) c.set_source_rgb(1, 1, 1) c.fill() for dx, dy, col in ((-12, -10, "#ff8c1a"), (12, -8, "#ffd23a"), (0, 12, "#3fae49"), (-14, 12, "#ff8fa3"), (14, 12, "#fff3a0")): c.arc(64 + dx, 64 + dy, 9, 0, 2 * math.pi) c.set_source_rgb(*rgb(col)) c.fill() def sundae_raw(c): # 접시에 담긴 통순대(누르는 도구) ellipse(c, 64, 92, 58, 22) fill_stroke(c, lin(0, 70, 0, 114, "#ffffff", "#cbd5e1")) c.move_to(20, 84) c.curve_to(14, 40, 70, 30, 72, 60) c.curve_to(74, 84, 108, 84, 110, 60) c.set_line_cap(cairo.LINE_CAP_ROUND) for w, col in ((30 + LW, INK), (30, rgb("#5a2e3c"))): c.move_to(20, 84) c.curve_to(14, 40, 70, 30, 72, 60) c.curve_to(74, 84, 108, 84, 110, 60) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() c.move_to(24, 70) c.curve_to(24, 48, 60, 40, 64, 56) c.set_line_width(5) c.set_source_rgba(1, 1, 1, 0.45) c.stroke() def sundae_piece(c): # 순대 한 토막(옆) rrect(c, 10, 40, 108, 48, 24) fill_stroke(c, lin(0, 40, 0, 88, "#8a5a6a", "#5a2e3c", "#3a1a24")) rrect(c, 24, 48, 50, 8, 4) c.set_source_rgba(1, 1, 1, 0.4) c.fill() def sundae_slice(c): c.arc(64, 64, 50, 0, 2 * math.pi) fill_stroke(c, rad(64, 64, 54, "#8a5a6a", "#5a2e3c", "#3a1a24")) for dx, dy in ((-16, -12), (12, -16), (16, 10), (-10, 16), (0, 0), (-20, 4)): c.arc(64 + dx, 64 + dy, 6, 0, 2 * math.pi) c.set_source_rgba(1, 0.85, 0.8, 0.7) c.fill() def fish_cake(c): # 납작한 어묵 한 장(누르는 도구) c.save() c.translate(64, 64) c.rotate(-0.15) rrect(c, -52, -36, 104, 72, 14) c.restore() fill_stroke(c, lin(0, 28, 0, 100, "#ffe2a8", "#f2b46b", "#d98a3a")) c.save() c.translate(64, 64) c.rotate(-0.15) rrect(c, -40, -26, 50, 8, 4) c.restore() c.set_source_rgba(1, 1, 1, 0.6) c.fill() def batter(c): # 튀김옷 그릇 bowl(c, ("#ffd1dc", "#ff7aa2"), "#fff6d6") for x, y in ((48, 58), (76, 62), (62, 56)): c.arc(x, y, 4, 0, 2 * math.pi) c.set_source_rgba(*INK, 0.2) c.fill() shine(c, 30, 84, 6, 12, 0.5) def shrimp(c, body, tail, dots): c.save() c.translate(64, 64) c.rotate(-0.5) c.move_to(-54, 0) c.curve_to(-54, -28, 30, -28, 40, -6) c.line_to(40, 6) c.curve_to(30, 28, -54, 28, -54, 0) c.close_path() c.restore() fill_stroke(c, body) c.save() c.translate(64, 64) c.rotate(-0.5) polygon(c, [(38, -2), (60, -20), (54, 0), (60, 20), (38, 2)]) c.restore() fill_stroke(c, rgb(tail), 5) if dots: for x, y in ((36, 72), (50, 64), (64, 56), (46, 82), (60, 74), (74, 66), (30, 62)): c.arc(x, y, 3.5, 0, 2 * math.pi) c.set_source_rgba(1, 1, 1, 0.6) c.fill() def shrimp_raw(c): shrimp(c, lin(20, 20, 110, 110, "#ffd0c2", "#ff9e8a", "#f07a66"), "#ff6b4a", False) for i in range(4): c.save() c.translate(64, 64) c.rotate(-0.5) c.move_to(-30 + i * 16, -16) c.curve_to(-26 + i * 16, -4, -26 + i * 16, 4, -30 + i * 16, 16) c.restore() c.set_source_rgba(*INK, 0.3) c.set_line_width(3) c.stroke() def shrimp_batter(c): shrimp(c, lin(20, 20, 110, 110, "#fffdf2", "#fff1c9", "#f5dfa0"), "#ff6b4a", True) def tongs(c): c.set_line_cap(cairo.LINE_CAP_ROUND) c.set_line_join(cairo.LINE_JOIN_ROUND) for w, col in ((14 + LW, INK), (14, rgb("#cbd5e1"))): c.move_to(40, 118) c.line_to(30, 20) c.line_to(54, 10) c.move_to(88, 118) c.line_to(98, 20) c.line_to(74, 10) c.set_line_width(w) c.set_source_rgb(*col) c.stroke() rrect(c, 30, 96, 68, 22, 10) fill_stroke(c, lin(0, 96, 0, 118, "#ff8a5a", "#d92f1c"), 6) def customer(c): # 손님 얼굴(주문 수 표시) c.arc(64, 70, 46, 0, 2 * math.pi) fill_stroke(c, rad(64, 70, 50, "#fff1e0", "#ffd7b0", "#f5b885")) c.move_to(18, 64) c.curve_to(18, 10, 110, 10, 110, 64) c.curve_to(96, 40, 40, 36, 18, 64) c.close_path() fill_stroke(c, lin(0, 20, 0, 64, "#6b4a3a", "#3f2a20"), 5) for x in (48, 80): c.arc(x, 74, 6, 0, 2 * math.pi) c.set_source_rgb(*INK) c.fill() c.arc(x + 2, 72, 2, 0, 2 * math.pi) c.set_source_rgb(1, 1, 1) c.fill() c.arc(64, 88, 10, 0.15 * math.pi, 0.85 * math.pi) c.set_source_rgb(*INK) c.set_line_width(4) c.stroke() for x in (36, 92): ellipse(c, x, 90, 8, 5) c.set_source_rgba(1, 0.5, 0.55, 0.5) c.fill() def mascot_face(c): # 떡이(떡볶이 떡 캐릭터) 얼굴 + 요리사 모자 rrect(c, 14, 40, 100, 78, 36) fill_stroke(c, lin(0, 40, 0, 118, "#ffffff", "#ffe4d6")) # 모자 for x, y, r in ((40, 30, 20), (64, 20, 24), (88, 30, 20)): c.arc(x, y, r, 0, 2 * math.pi) fill_stroke(c, rgb("#ffffff"), 5) rrect(c, 30, 30, 68, 20, 6) fill_stroke(c, rgb("#ffffff"), 5) rrect(c, 34, 32, 60, 14, 4) c.set_source_rgb(1, 1, 1) c.fill() # 눈·입·볼 for x in (46, 82): ellipse(c, x, 76, 7, 9) c.set_source_rgb(*INK) c.fill() c.arc(x + 2, 72, 3, 0, 2 * math.pi) c.set_source_rgb(1, 1, 1) c.fill() c.move_to(54, 90) c.curve_to(58, 102, 70, 102, 74, 90) c.close_path() fill_stroke(c, rgb("#ff6b6b"), 4) for x in (32, 96): ellipse(c, x, 92, 9, 6) c.set_source_rgba(1, 0.45, 0.5, 0.55) c.fill() def heart(c): c.move_to(64, 112) c.curve_to(10, 74, 8, 30, 38, 22) c.curve_to(52, 18, 62, 28, 64, 38) c.curve_to(66, 28, 76, 18, 90, 22) c.curve_to(120, 30, 118, 74, 64, 112) c.close_path() fill_stroke(c, lin(0, 20, 0, 112, "#ff9fb5", "#ff4d7a")) shine(c, 40, 42, 10, 7, 0.7) def cart(c): # 상점(업그레이드) 버튼: 위쪽 화살표가 붙은 가게 차양 rrect(c, 18, 56, 92, 58, 10) fill_stroke(c, lin(0, 56, 0, 114, "#fff7ec", "#f3d9b8")) rrect(c, 50, 78, 28, 36, 6) fill_stroke(c, lin(0, 78, 0, 114, "#ffb35a", "#e07a1f"), 5) for i in range(5): x = 10 + i * 22 c.move_to(x, 30) c.line_to(x + 22, 30) c.line_to(x + 22, 52) c.curve_to(x + 22, 64, x, 64, x, 52) c.close_path() fill_stroke(c, rgb("#ff5a7a" if i % 2 == 0 else "#ffffff"), 5) rrect(c, 8, 18, 112, 16, 8) fill_stroke(c, rgb("#ff5a7a"), 5) def pot_icon(c): # 요리하기(냄비) 아이콘 rrect(c, 14, 50, 100, 60, 20) fill_stroke(c, lin(0, 50, 0, 110, "#ff8a6a", "#d92f1c")) rrect(c, 4, 58, 16, 14, 6) fill_stroke(c, rgb("#7c4a24"), 5) rrect(c, 108, 58, 16, 14, 6) fill_stroke(c, rgb("#7c4a24"), 5) ellipse(c, 64, 50, 52, 12) fill_stroke(c, rgb("#ffcf5a"), 5) for x in (44, 64, 84): c.move_to(x, 34) c.curve_to(x - 8, 24, x + 8, 16, x, 6) c.set_source_rgba(1, 1, 1, 0.95) c.set_line_width(6) c.stroke() shine(c, 32, 70, 8, 12, 0.5) 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), ("riceCake", rice_cake), ("riceCakeRed", rice_cake_red), ("riceCakes", rice_cakes), ("sauceBowl", sauce_bowl), ("sauceBlob", sauce_blob), ("spatula", spatula), ("bubble", bubble), ("steam", steam), ("fillings", fillings), ("mat", mat), ("knife", knife), ("gimbapSlice", gimbap_slice), ("sundaeRaw", sundae_raw), ("sundaePiece", sundae_piece), ("sundaeSlice", sundae_slice), ("fishCake", fish_cake), ("batter", batter), ("shrimpRaw", shrimp_raw), ("shrimpBatter", shrimp_batter), ("tongs", tongs), ("customer", customer), ("mascot", mascot_face), ("heart", heart), ("cart", cart), ("pot", pot_icon), ] 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:])