Fix photo stripes and keep GIF playback off the UI thread.

Use cover/stretch display, solid sample assets, core0 GIF decode without blocking touch, and always-commit project rule.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-19 18:18:03 +08:00
parent 800e168b98
commit 6cf42d56a7
14 changed files with 337 additions and 178 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Generate 320x240 JPG/PNG/GIF samples into assets/photos."""
"""Generate 320x240 JPG/PNG/GIF samples into assets/photos (solid bg, no stripes)."""
from __future__ import annotations
from pathlib import Path
@@ -27,16 +27,13 @@ def font(size: int = 28) -> ImageFont.ImageFont:
def card(bg, accent, title: str, subtitle: str, path: Path, fmt: str) -> None:
im = Image.new("RGB", (W, H), bg)
d = ImageDraw.Draw(im)
for i in range(0, H, 12):
c = tuple(max(0, min(255, v + (i % 24) - 12)) for v in accent)
d.rectangle((0, i, W, i + 6), fill=c)
d.rectangle((16, 40, W - 16, H - 40), fill=bg)
d.rectangle((16, 40, W - 16, H - 40), outline=accent, width=3)
d.text((28, 70), title, fill=(234, 240, 246), font=font(36))
d.text((28, 130), subtitle, fill=(122, 139, 156), font=font(20))
d.text((28, 170), "CYD ALBUM TEST", fill=accent, font=font(16))
# Solid panel only — no horizontal stripe decoration
d.rounded_rectangle((20, 36, W - 20, H - 36), radius=12, fill=bg, outline=accent, width=3)
d.text((36, 70), title, fill=(234, 240, 246), font=font(36))
d.text((36, 130), subtitle, fill=(160, 175, 190), font=font(20))
d.text((36, 170), "CYD ALBUM TEST", fill=accent, font=font(16))
if fmt == "JPEG":
im.save(path, "JPEG", quality=90)
im.save(path, "JPEG", quality=92)
else:
im.save(path, "PNG")
print(f"wrote {path} ({path.stat().st_size} bytes)")
@@ -45,7 +42,7 @@ def card(bg, accent, title: str, subtitle: str, path: Path, fmt: str) -> None:
def main() -> None:
OUT.mkdir(parents=True, exist_ok=True)
card((10, 16, 22), (79, 195, 247), "01 JPG", "tap left / right", OUT / "01_blue.jpg", "JPEG")
card((20, 12, 28), (232, 93, 76), "02 JPG", "red sample", OUT / "02_red.jpg", "JPEG")
card((28, 12, 18), (232, 93, 76), "02 JPG", "red sample", OUT / "02_red.jpg", "JPEG")
card((8, 28, 20), (61, 220, 151), "03 PNG", "green sample", OUT / "03_green.png", "PNG")
frames = []
@@ -53,10 +50,9 @@ def main() -> None:
im = Image.new("RGB", (W, H), (10, 16, 22))
d = ImageDraw.Draw(im)
d.text((24, 24), "04 GIF", fill=(234, 240, 246), font=font(32))
d.text((24, 70), "animated", fill=(122, 139, 156), font=font(18))
d.text((24, 70), "animated", fill=(160, 175, 190), font=font(18))
x = 20 + i * 40
d.rectangle((x, 120, x + 80, 180), fill=(255, 200, 40))
d.rectangle((20, 200, 300, 210), fill=(36, 49, 64))
d.rounded_rectangle((x, 120, x + 80, 180), radius=8, fill=(255, 200, 40))
frames.append(im)
gif_path = OUT / "04_bounce.gif"
frames[0].save(