Radio rendering pixel-exact: the display's circle routine

Harvested the cir/cirs output for every radius 1..159 from Nextion
Editor's simulator and derived the incremental midpoint rule that
reproduces all of them; radio = width-sized circle clipped to the box,
dot radius r//2. Basic rendering coverage 18/20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-15 15:53:13 +01:00
1 parent 6f8341c66c
commit 9b50eea03f
7 files changed
+83 -14

No files matched your search

+10 -5
View File
@@ -10,7 +10,7 @@ The demo project (`demo/demo.HMI`, built by `examples/make_demo.py`):
| Page | Differing pixels | Notes |
|---|---|---|
| home | 94 | all in the two radio buttons and at name-tag edges |
| home | 30 | name-tag edges (checkbox) and gauge needle anti-aliasing |
| controls | 5 | name-tag edges |
| gallery | 1 | name-tag edge |
@@ -32,7 +32,7 @@ Per component (dedicated test pages):
| picture, crop (also smaller than the component) | 100 % | only the picture's real area is drawn |
| waveform (frame + grid) | 100 % | horizontal grid lines count from the bottom |
| gauge | 99.3 - 100 % | needle anti-aliasing differs by a few px |
| radio | ~93 - 97 % | circle outline/dot differ by +-1 px at some radii (work in progress) |
| radio (all sizes, also non-square) | 100 % | the display's own circle routine, see below |
| QR code | placeholder only | |
| hotspot, touch cap, timer, variable | nothing drawn (same as the Editor) | |
@@ -46,10 +46,15 @@ Per component (dedicated test pages):
- Buttons with a picture background (`sta` crop or image) get no frame.
- Pictures are pasted at their real size; a smaller picture leaves the rest untouched.
- Checkbox: `bco` fill, `style` frame, checked = `pco` square from w/4 to 3w/4.
- Radio: circle sized by the component *width* (clipped to the height); ring radius
`(w-1)//2`, colour (65,68,65), filled with `bco`; checked = `pco` dot.
- Radio: circle sized by the component *width* (clipped to the box); ring radius
`r = (w-1)//2` around `(r, r)`, colour (65,68,65), filled with `bco`; checked = `pco` dot of
radius `r // 2`.
- Circles (radio, and the display's `cir`/`cirs` commands): incremental midpoint routine --
start at `x = r, y = 0`; plot the 8 symmetric points; `y += 1`; if
`x*x - x + y*y + 2*y > r*r + 1` then `x -= 1`; repeat while `x >= y`. Filled circles are every
pixel inside that ring. Verified for every radius 1..159 against the Editor's simulator.
- 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: exact radio circles, QR codes, Intelligent-only components (need Intelligent
Not covered yet: QR codes, Intelligent-only components (need Intelligent
picture format 4), anti-aliased fonts, pressed/runtime states.