Skip to content

toolkit: a dot that says live - #435

Merged
tannevaled merged 2 commits into
mainfrom
a-dot-that-says-live
Aug 30, 2026
Merged

toolkit: a dot that says live#435
tannevaled merged 2 commits into
mainfrom
a-dot-that-says-live

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

A status light is the smallest thing a picture can say — "this is on", "this is recording", "this is connected". Every caller that wanted one had to reach past the toolkit and call the painter directly, which is precisely what a consumer's barrier test refuses: a capability the toolkit lacks gets added to the toolkit, not hand-drawn at the call site.

DrawIconDot(p, r, ink) fills the rectangle it is given, less the inset every icon here already leaves, with a round rectangle whose radius is half its shorter side — which is a disc, drawn with the same antialiasing as the rest of the package. Nothing rasterises a circle by hand. Round in a square box, an ellipse in any other: a caller asking for a wide box means a wide dot.

How it is tested. Roundness is judged by the corners: a square inks all four, a disc none. Area does not say it as plainly — an anti-aliased disc touches about 85% of its bounding box where the disc itself is π/4 of it, about 79% — so the corner is the crisp statement. A filled rectangle of the same size is drawn alongside as a negative control, so a DrawIconDot that quietly lost its radius fails rather than passes. Below ten pixels the check is skipped, and the comment says why: a disc four pixels across touches all sixteen of them, corners included, so nothing there separates it from a square, and asserting otherwise would assert something untrue of a dot at a real size.

Also covered: the ink stays inside its box at every size, it is square to the pixel in a square box, and a box with no room draws nothing rather than a stray pixel.

Coverage stays at 100.0%.

A status light is the smallest thing a picture can say -- "this is on",
"this is recording", "this is connected" -- and every caller that wanted
one so far had to reach past the toolkit and call the painter itself.
That is exactly what the desk's own barrier test refuses, and rightly:
the rule is that a capability the toolkit lacks gets ADDED to the
toolkit, not hand-drawn at the call site.

DrawIconDot fills the rectangle it is given, less the inset every icon
here already leaves, with a round rectangle whose radius is half its
shorter side -- which IS a disc, drawn with the same antialiasing as the
rest of the package. Nothing rasterises a circle by hand.

The test judges roundness by the CORNERS: a square inks all four, a disc
none. Area does not say it as plainly -- an anti-aliased disc touches
about 85% of its bounding box where the disc itself is pi/4 of it -- and
a filled rectangle of the same size is drawn alongside as a negative
control, so a DrawIconDot that quietly lost its radius fails rather than
passes. Below ten pixels the corner check is skipped and said to be
skipped: a disc four pixels across touches all sixteen of them, corners
included, so nothing there separates it from a square.
The radius follows the SHORTER side, and no test passed a box where the
two differ -- so the line that picks it was never taken. A wide box and
a tall one, each asserted to give a dot the same way round as its box.
@tannevaled
tannevaled merged commit c8232ae into main Aug 30, 2026
1 check passed
@tannevaled
tannevaled deleted the a-dot-that-says-live branch August 30, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant