mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 12:54:29 +01:00
MENU > DISPLAY > COLOR offers exactly seven, all the owner's: JIANT (unchanged, the default) and six of its own. The ten inherited from Felucca (GREY GREEN AMBER ICE VIOLET ROSE PAPER HI-CON NIGHT MONO) are gone. - tools/gen_ui_palettes.py: a palette is twelve stored tokens (bg surf text theme accent mid dim line sel tint rec raise); JIANT's are its five colours and the blends it has had since 0.8.9 (bit for bit), the six new ones the owner's hex values at the nearest RGB565. INK is black in all. NEON's SEL a step lighter than set (#D43589) so black INK on it passes 4.5. - gfx.c palette_set copies the twelve; KEY, LANE, GRID stay derived. The GREY (gray axis), MONO (black and white) and PAPER (light) paths are removed: ux.mono, ux.light, the light coverage curve, ux_gray / ux_luma, the knob table per palette. - The thermal ramp (beings, notes, bars, card values) in every palette. - Saved ids: UI_PAL_TAG + the place the nearest palette had up to V10.7.18, so old settings land on the nearest of the family (GREY MONO NIGHT -> HUESO, GREEN -> SELVA, AMBER ROSE -> BRASA, ICE -> ABISAL, VIOLET -> JIANT, PAPER HI-CON -> CONTRAST) and older firmware reads new settings as its nearest palette (NEON: a new id, its fallback). The record's format and version are unchanged. - A card value too long for S (COLOR's CONTRAST) is set whole in the small face; COLOR's chips fit it. An arrange row of an empty section is a well (DIM on the section's colour could not be read). - Tests: theme_test (the family, the stored tokens, the knobs' contrast; its probe glyph in the byte-packed format, which is what failed before), settings_test and backup_test (the migration), ui_test, ui_render (gray / neutral lints replaced by a contrast lint of every ink drawn), editor_test, the web mock. - Manuals (EN, ES), README, cheat sheet text, EDITOR_PROTOCOL. Image: 1992 B free (was 256). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
75 lines
4.3 KiB
Python
75 lines
4.3 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
# Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
|
|
# Portions Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
|
|
"""PPM -> PNG for the UI renders of tests/ui_render.c (Pillow). Under OUTDIR (default build/ui_new):
|
|
(the STEP page's piano roll scenes, roll_* step chance drum: also in build/ui_roll/<PALETTE>_<screen>.png)
|
|
<PALETTE>/<screen>.png 240 x 240, true size
|
|
sheet_<PALETTE>.png every screen of one palette, 1x, with its name
|
|
(MENU > STYLE: LINE_<PALETTE>/ and sheet_LINE_<PALETTE>.png for JIANT CONTRAST HUESO NEON;
|
|
MENU > LARGE: sheet_LARGE_JIANT.png, sheet_LARGE_CONTRAST.png, sheet_LARGE-LINE_JIANT.png;
|
|
(0.8.9) MENU > SKIN: BOTTOM_<PALETTE>/, HUD_<PALETTE>/ (0.9.7: AIR_<PALETTE>/) and their sheets for JIANT CONTRAST HUESO)
|
|
With SLOTDIR (ui_render.py OUTDIR SLOTDIR): its filmstrips of the rolling digits, SLOTDIR/*.ppm -> *.png.
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from PIL import Image, ImageDraw
|
|
|
|
out = Path(sys.argv[1] if len(sys.argv) > 1 else "build/ui_new")
|
|
shots = {}
|
|
for f in sorted((out / "ppm").glob("*.ppm")):
|
|
pal, name = f.stem.split("_", 1)
|
|
styled = pal in ("LINE", "LARGE", "LARGE-LINE", "BOTTOM", "HUD", "AIR") # STYLE / MENU > LARGE / (0.8.9) SKIN renders: <STYLE>_<PALETTE>_<screen>
|
|
if styled:
|
|
p2, name = name.split("_", 1)
|
|
pal = f"{pal}_{p2}"
|
|
(out / pal).mkdir(parents=True, exist_ok=True)
|
|
img = Image.open(f).convert("RGB")
|
|
img.save(out / pal / f"{name}.png")
|
|
shots.setdefault(pal, []).append((name, img))
|
|
if styled:
|
|
continue
|
|
if pal in ("JIANT", "CONTRAST", "SELVA") and (name.startswith("perform_") or name == "menu_hold"): # the FX layer's screens
|
|
(out.parent / "ui_fx").mkdir(parents=True, exist_ok=True)
|
|
img.save(out.parent / "ui_fx" / f"{pal}_{name}.png")
|
|
if pal in ("JIANT", "CONTRAST", "SELVA") and (name.startswith("layer_") or name.startswith("perform_")): # the quick layers
|
|
(out.parent / "ui_layers").mkdir(parents=True, exist_ok=True)
|
|
img.save(out.parent / "ui_layers" / f"{pal}_{name}.png")
|
|
if name.startswith("roll_") or name in ("step", "chance", "drum"): # the STEP page's piano roll (and the grid)
|
|
(out.parent / "ui_roll").mkdir(parents=True, exist_ok=True)
|
|
img.save(out.parent / "ui_roll" / f"{pal}_{name}.png")
|
|
if pal in ("JIANT", "CONTRAST", "SELVA") and (name.startswith("name_") or name in ("project_named", "song_named", "user_foot")):
|
|
(out.parent / "ui_name").mkdir(parents=True, exist_ok=True) # NAME (src/ui_name.c) and the names it shows
|
|
img.save(out.parent / "ui_name" / f"{pal}_{name}.png")
|
|
for pal in ("JIANT", "CONTRAST", "SELVA"): # DIGITAL's 8 algorithm charts (+ OP LEVEL): x3, the panel, in build/ui_alg/
|
|
algs = [(n, im) for n, im in shots.get(pal, []) if n.startswith("alg_") or n == "op_level"]
|
|
if not algs:
|
|
continue
|
|
(out.parent / "ui_alg").mkdir(parents=True, exist_ok=True)
|
|
pw, ph, lh = 240 * 3, 122 * 3, 18
|
|
sheet = Image.new("RGB", (2 * pw + 24, ((len(algs) + 1) // 2) * (ph + lh + 8) + 8), (90, 90, 90))
|
|
d = ImageDraw.Draw(sheet)
|
|
for i, (name, img) in enumerate(algs):
|
|
big = img.resize((720, 720), Image.NEAREST)
|
|
big.save(out.parent / "ui_alg" / f"{pal}_{name}.png")
|
|
x, y = 8 + (i % 2) * (pw + 8), 8 + (i // 2) * (ph + lh + 8)
|
|
sheet.paste(big.crop((0, 76 * 3, pw, 198 * 3)), (x, y))
|
|
d.text((x, y + ph + 3), name.replace("alg_", "ALG "), fill=(235, 235, 235))
|
|
sheet.save(out.parent / "ui_alg" / f"sheet_{pal}.png")
|
|
for pal, items in shots.items():
|
|
cols, cw, ch = 8, 248, 262
|
|
rows = (len(items) + cols - 1) // cols
|
|
sheet = Image.new("RGB", (cols * cw + 8, rows * ch + 8), (90, 90, 90))
|
|
d = ImageDraw.Draw(sheet)
|
|
for i, (name, img) in enumerate(items):
|
|
x, y = 8 + (i % cols) * cw, 8 + (i // cols) * ch
|
|
sheet.paste(img, (x, y))
|
|
d.text((x, y + 242), name, fill=(235, 235, 235))
|
|
sheet.save(out / f"sheet_{pal}.png")
|
|
print(f"ui_render: PNGs in {out}/<palette>/ and {out}/sheet_<palette>.png")
|
|
if len(sys.argv) > 2:
|
|
for f in sorted(Path(sys.argv[2]).glob("*.ppm")):
|
|
Image.open(f).convert("RGB").save(f.with_suffix(".png"))
|
|
print(f"ui_render: rolling-digit filmstrips in {sys.argv[2]}/*.png")
|