Render QR codes pixel-exact with an own encoder
nxhmi.qr is a dependency-free QR encoder. Measured in the Editor simulator: numeric/alphanumeric/byte mode by content, level L, mask 0, smallest version; scaled to w - 2*dis by width (not clipped to h), last column run one pixel narrower, logo centred, nothing when too small. Basic rendering is now 20/20 pixel-exact. Also: unknown component kinds give a clean CLI error instead of a traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0bcc608b1
commit
842591a14c
10 files changed
+429
-9
No files matched your search
+1
-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 | Basic series **complete**; Intelligent compressed format **missing** |
|
||||
| Fonts | black/white **complete** incl. generation from TrueType; anti-aliased **missing** |
|
||||
| Rendering pages like the Editor | **pixel-identical** for most components incl. picture skins, radios and gauges; QR placeholder |
|
||||
| Rendering pages like the Editor | **pixel-identical** for most components for every Basic component incl. picture skins, radios, gauges and QR codes |
|
||||
| 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 |
|
||||
|
||||
@@ -98,7 +98,6 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
|
||||
### Rendering
|
||||
| Item | Notes |
|
||||
|---|---|
|
||||
| QR code | placeholder; needs the Editor's QR settings |
|
||||
| Pressed / runtime states, Intelligent-only components | not drawn |
|
||||
|
||||
### `.tft` compilation (firmware for the display)
|
||||
|
||||
+10
-2
@@ -33,7 +33,7 @@ Per component (dedicated test pages):
|
||||
| waveform (frame + grid) | 100 % | horizontal grid lines count from the bottom |
|
||||
| gauge (every angle, needle width 1-8, odd/even/non-square sizes) | 100 % | the needle routine, see below |
|
||||
| radio (all sizes, also non-square) | 100 % | the display's own circle routine, see below |
|
||||
| QR code | placeholder only | |
|
||||
| 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) | |
|
||||
|
||||
## Rules learned from the Editor
|
||||
@@ -60,8 +60,16 @@ Per component (dedicated test pages):
|
||||
and `24*sin 30` truncates to 11). The line runs from the tip to the centre: step the major
|
||||
axis, minor offset `(k*minor + minor - 1) // major`. Width > 1: every line pixel is stamped
|
||||
with a `wid` x `wid` square starting at `-(wid//2)`.
|
||||
- QR code: the text's bytes (iso-8859-1) encoded in numeric mode if all digits, alphanumeric
|
||||
if all in `0-9A-Z $%*+-./:`, else byte mode; error correction **L**, **mask 0** always, the
|
||||
smallest version that fits. Drawn into a square of `w - 2*dis` px at `(dis, dis)` -- sized by
|
||||
the width only and *not* clipped to `h`; pixel `p` shows module `p*N//size`. Dark runs are
|
||||
drawn column by column and the last one (last column, reaching the bottom) is one pixel
|
||||
narrower. Fewer pixels than modules or empty text: only the `bco` background. `sta` 1:
|
||||
picture `pic` pasted centred in the box. Big codes can exceed a Basic display's RAM (the
|
||||
Editor refuses to compile), the canvas still draws them.
|
||||
- Slider: auto cursor (255) is a square as thick as the slider; position = `int(frac * free)`.
|
||||
- Waveform: vertical grid lines from the left edge, horizontal ones counted from the bottom.
|
||||
|
||||
Not covered yet: QR codes, Intelligent-only components (need Intelligent
|
||||
Not covered yet: Intelligent-only components (need Intelligent
|
||||
picture format 4), anti-aliased fonts, pressed/runtime states.
|
||||
Reference in new issue
Block a user