Render Intelligent-only components; fonts follow the display direction
- SLText, TextSelect, DataRecord, FileBrowser pixel-exact against the Intelligent simulator; ComboBox and Switch with approximate anti-aliased edges; media/file components draw nothing - fonts: header byte 3 = 0x0A + direction, glyphs in the direction's pixel order, Intelligent glyph data 4-byte aligned -- reproduces the Editor's own font conversion byte for byte - Intelligent 3D frames: left edge drawn over the bottom edge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
56062e1a3e
commit
49fee337d7
10 files changed
+334
-32
No files matched your search
+3
-2
@@ -15,7 +15,7 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
|
||||
| Readable JSON (enum names, colours) | done for every value list the Editor documents |
|
||||
| Pictures | **complete**: format 0 (Basic) and format 4 (Intelligent, with alpha), all display directions |
|
||||
| Fonts | black/white **complete** incl. generation from TrueType; anti-aliased **missing** |
|
||||
| Rendering pages like the Editor | **pixel-identical** for every Basic component incl. picture skins, radios, gauges and QR codes |
|
||||
| Rendering pages like the Editor | **pixel-identical** for every Basic component and 9 of 11 Intelligent-only ones; ComboBox and Switch approximate at anti-aliased edges |
|
||||
| New projects from scratch | `project.new_project(model)` for 12 Basic/Intelligent models; the generated demo is byte-identical to the Editor's re-save |
|
||||
| Compiling `.tft` firmware | **research only** -- not possible yet |
|
||||
|
||||
@@ -100,7 +100,8 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
|
||||
### Rendering
|
||||
| Item | Notes |
|
||||
|---|---|
|
||||
| Pressed / runtime states, Intelligent-only components | not drawn |
|
||||
| Pressed / runtime states | not drawn |
|
||||
| Anti-aliased edges (Switch, ComboBox) | approximate: the simulator's coverage routine is unknown (the knob looks like a scaled pre-drawn image) |
|
||||
|
||||
### `.tft` compilation (firmware for the display)
|
||||
| Item | Status |
|
||||
|
||||
+7
-4
@@ -242,16 +242,19 @@ Adding a picture = `N.is` + `N.i` + a `i`/`N.i` resource-list entry (kept groupe
|
||||
|
||||
## 5. Fonts (`N.zi`, format version 6)
|
||||
|
||||
Header 44 bytes: magic `04 FF 00 0B`, u16 encoding (3 = iso-8859-1), u8 width, u8 height,
|
||||
Header 44 bytes: magic `04 FF 00` + `0x0A + display direction` (like pictures), u16 encoding (3 = iso-8859-1), u8 width, u8 height,
|
||||
multi-byte range (2 bytes), code range first/last, u32 character count, u8 version = 6,
|
||||
u8 name length (twice) + 0, u32 length of name+map+glyphs, u32 name offset = 0x2C, 16 unknown
|
||||
bytes. Then the name, the character map, the glyph data.
|
||||
|
||||
Character map: 10 bytes per character: u16 code, u8 glyph width, 2 unknown bytes,
|
||||
u24 glyph offset (relative to the map start), u16 glyph length.
|
||||
u24 glyph offset (relative to the map start), u16 glyph length. In Intelligent projects the glyph
|
||||
data starts 4-byte aligned (zero padding after the map); Basic fonts have no padding.
|
||||
|
||||
Glyph: mode byte (0x01 = black/white), then run-length codes over the pixels in the same
|
||||
column-by-column, bottom-to-top order as pictures (runs continue across columns):
|
||||
Glyph: mode byte (0x01 = black/white), then run-length codes over the pixels in the same order
|
||||
as pictures for the project's display direction (runs continue across rows/columns): at 90° column
|
||||
by column, bottom to top; at 0° row by row. When an Intelligent project is compiled, the Editor
|
||||
converts a 90° font to the project direction; our encoder reproduces that conversion byte for byte.
|
||||
|
||||
| Code | Meaning |
|
||||
|---|---|
|
||||
|
||||
@@ -36,11 +36,40 @@ Per component (dedicated test pages):
|
||||
| QR code (byte/alphanumeric/numeric text, versions 1-8, margins, colours, logo, Latin-1) | 100 % | own encoder (`nxhmi.qr`), see below |
|
||||
| hotspot, touch cap, timer, variable | nothing drawn (same as the Editor) | |
|
||||
|
||||
Intelligent-only components, checked against the **Intelligent simulator** (5 test pages, 23
|
||||
TextSelects, several of each other type):
|
||||
|
||||
| Component | Match | Notes |
|
||||
|---|---|---|
|
||||
| SLText | 100 % | text from the top-left inside the frame |
|
||||
| TextSelect (hig, val, borders, fonts, cut cells) | 100 % | see rules below |
|
||||
| DataRecord (header, 1-5 columns, styles) | 100 % | records only exist at run time |
|
||||
| FileBrowser | 100 % | frame and fill; the file list only exists at run time |
|
||||
| ExPicture, video, audio, Gmov, FileStream | nothing drawn (same as the simulator) | they show content only once a file is loaded |
|
||||
| ComboBox | ~99 % | structure exact; anti-aliased corners and arrow approximate |
|
||||
| Switch | ~88-97 % | structure exact; anti-aliased knob and track edges approximate |
|
||||
|
||||
## Rules learned from the Editor
|
||||
|
||||
- Colours: RGB565 is expanded differently per series. Basic replicates the top bits
|
||||
(`r<<3 | r>>2`); Intelligent scales (`r*255//31`, `g*255//63`), so `0xC618` shows as
|
||||
(198,195,198) on Basic and (197,194,197) on Intelligent.
|
||||
- Intelligent 3D frames draw the left edge after the bottom one (dark bottom-left corner on
|
||||
3D down); Basic draws it the other way round.
|
||||
- TextSelect: items (`path`, CR LF separated) in cells of `hig` rows inside the frame; the
|
||||
selected cell starts at `iy + (ih - hig) // 2` and its two `pco1` lines are mirrored
|
||||
(`top` and `iy + ih - 1 - (ih - hig) // 2`); selected text `pco2`, others `pco`; `val` out
|
||||
of range selects item 0; the list wraps around. Text is centred in its full cell and clipped
|
||||
to the frame; a cell cut by the *screen* bottom centres in the part on screen. Rows within
|
||||
`hig` of the top/bottom edge fade into `bco`: 7-bit alpha `(127 // hig) * d`, blended
|
||||
`(fg*a + bg*(127-a)) // 127`.
|
||||
- DataRecord: `dez` columns named by `dir` (`^`-separated); column lines in `gdc` every
|
||||
`(iw - 1) // dez` px, the last `(iw - 1) % dez` columns one px wider; header `hig` rows in
|
||||
`bco1`, names in `pco1` placed by `xcen`, vertically centred.
|
||||
- Switch: track `bco`/`bco2` (on), knob `pco`/`pco2`, text `txt` = "off/on" in `pco1` centred in
|
||||
`[h, w)` (off) or `[0, w-h)` (on). ComboBox: text placed by `xcen`/`ycen` over the whole box,
|
||||
`pco3` arrow `wid` px wide 4.5 px from the right edge. Corner radius for both: `dis * h // 200`,
|
||||
square below 3 px; rounded shapes are inset half a pixel (outer ring 50 %, blended linearly).
|
||||
- Intelligent pictures with alpha (format 4, 7-bit alpha `a`): 8-bit alpha is `2*a` (127 = 255),
|
||||
blended as `bg + round((src - bg) * alpha / 255)` per channel. Exact against the Intelligent
|
||||
simulator (342 samples). The Editor *canvas* blends slightly differently (up to 3 levels off at
|
||||
|
||||
Reference in new issue
Block a user