Switch knob: scanline model from 42 measured sizes

Integer radius (h-1)//2 with fixed sub-pixel offsets, 4 sub-rows x 1/8 px spans, 1/32 coverage
in linear light; closer to the simulator than the previous distance model on the knob test page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-16 13:52:40 +01:00
1 parent 0138a0ba56
commit 922ca21f0f
3 files changed
+35 -4

No files matched your search

+6 -1
View File
@@ -47,7 +47,7 @@ TextSelects, several of each other type):
| 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 |
| Switch | ~88-97 % | structure exact; anti-aliased knob and track edges approximate (see below) |
## Rules learned from the Editor
@@ -70,6 +70,11 @@ TextSelects, several of each other type):
`[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).
- Switch knob (measured on 42 sizes): radius `r = (h-1)//2` with fixed sub-pixel offsets, edge
coverage in steps of exactly 1/32 blended in linear light; the top row always holds a single
1/4-row span, so it is a scanline rasteriser (4 sub-rows x 1/8 px). The best model found
(centre `r + 0.625, r + 0.25`, radius `r - 0.25`, span ends rounded to 1/8) gets most edge pixels
exact but the span widths curve more sharply than a circle, so the real routine is still open.
- 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