tft: picture, crop, progress bar, checkbox, radio; page RAM header fix; README sub-goals
- five more Basic types in tft_types (default variants; others refused) - the page RAM image starts with 4 x FF + one FF per component (padded to 4) - README: .tft status split into sub-goals with a stated basis each - sample generator: display direction and gradient pictures; regression test walks sub-folders (84 Editor samples reproduced) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
a8622e7462
commit
0287cf21e4
8 files changed
+101
-10
No files matched your search
@@ -25,12 +25,21 @@ from nxhmi.page import Page # noqa: E402
|
||||
def make(spec):
|
||||
kw = {"program": spec["program"]} if "program" in spec else {}
|
||||
h = project.new_project("NX4832T035_011", **kw)
|
||||
if "direction" in spec: # 0..3 = 0/90/180/270 degrees (main.HMI byte 12)
|
||||
from nxhmi import models
|
||||
from nxhmi.container import build
|
||||
w, hh = models.page_size("NX4832T035_011", spec["direction"])
|
||||
h = build([("main.HMI", project.make_main("NX4832T035_011", [("pa", "0.pa")], "iso-8859-1", spec["direction"])),
|
||||
("Program.s", h.read("Program.s")), ("0.pa", C.new_page("page0", w=w, h=hh).pack())])
|
||||
for height in spec.get("fonts", []):
|
||||
project.add_font(h, fonts.from_ttf(None, height))
|
||||
for i, (w, hh) in enumerate(spec.get("pics", [])):
|
||||
from PIL import Image
|
||||
b = io.BytesIO()
|
||||
Image.new("RGB", (w, hh), (200, 40 + 30 * i, 40)).save(b, "PNG")
|
||||
im = Image.new("RGB", (w, hh), (200, 40 + 30 * i, 40))
|
||||
if spec.get("gradient"): # every pixel different: shows how pictures are rotated
|
||||
im.putdata([((x * 8) & 255, (y * 8) & 255, (x + y) & 255) for y in range(hh) for x in range(w)])
|
||||
im.save(b, "PNG")
|
||||
project.add_picture(h, b.getvalue())
|
||||
for pi, ps in enumerate(spec.get("pages", [spec])):
|
||||
if pi:
|
||||
|
||||
Reference in new issue
Block a user