Skip to content

Ariadne: background: on a window or group (media M2, stacked on #931) - #932

Merged
transfix merged 21 commits into
masterfrom
feat/ariadne-media-background
Nov 2, 2026
Merged

transfix merged 21 commits into
masterfrom
feat/ariadne-media-background

Conversation

@transfix

@transfix transfix commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Media M2 from the design (#929). Stacked on #931: this branch contains #931's commit (b2e1323), so its diff shows both until #931 merges. Review only def77d8. It targets master so the full CI runs.

- window: Profile
  background: {src: https://media.example/bg/42.jpg, opacity: 0.4}
  children:
    - type: group
      size: [auto, 120]
      background:
        bind: profile.banner_url    # or src:; a URI (§5.11) or a published image name
        auth: example
        fit: cover                  # cover | contain | fill
        opacity: 1.0
        terminal: banner            # behind (default) | banner | none
        banner_rows: 6
        status: profile.banner_status
      children: [...]

Reference: docs/ARIADNE.md §5.12.

  • Core. background: is parsed on window/overlay/group (a bare URL is short for src:). The picture loads through Ariadne: image: shows a picture by URL (media M1) #931's cache at its own shape. The content is bracketed by the new Backend::begin_backdrop(Backdrop) / end_backdrop(), which nest like grids. While the picture loads, or when it failed, the backdrop has no image, and the content is drawn as without one.

  • ImGui. The content goes on channel 1 of an ImDrawListSplitter. The picture is drawn on channel 0 once the area is known:

    • a window's backdrop fills its InnerRect;
    • a group's fills its rect, full width unless size: says otherwise and at least size:'s height;
    • fit sets the UVs and opacity the tint alpha.

    Draw-list splitting nests, so tables inside still work.

  • FTXUI and tvision.

    • behind draws half-blocks dimmed by opacity. A pass after the content turns each text cell readable: the picture's colour as background, at most 40%, and the terminal's own foreground unless the document coloured the text.
    • banner draws a picture row above the content, in Kitty/Sixel/iTerm pixels from the second frame (once the row's width is known), else half-blocks.
    • none draws nothing, and mono draws no background.
    • Pixel protocols can't put text over pixels, which is why behind is always half-blocks. This is documented.

Tests

  • ariadne_media_test +3: the loader (map, URL, clamping, a warning on a non-container), core bracketing (empty image while loading, then one shared picture for both backdrops at source size), and the FTXUI layout (2 banner rows, picture cells beside the text in behind).
  • cvcgl_imgui_media +5: a window and group backdrop with their fit and opacity, the group's authored 120 px height, and the draw list merged back.
  • ari_run_media_images_{ftxui,tvision}: the tmux document now has a window background, and the test checks picture cells beside its text on both backends.

Verified locally (GCC 13, Release): ctest Ariadne|Ari|ari_|Media|cvcgl_imgui|cvcgl_ari, 632/632 (1 skipped as on master). clang-format 18 is clean. Not checked visually in a real GL window (no X server here).

Since opening: master merged in (#900, #914). BackdropTerminal::None was renamed to Off, because X11 defines None. A coloured text: no longer paints the backdrop cells beside it (MediaBackground.ColouredTextDoesNotPaintTheBackdropBesideIt). New token image.background.

Joe Rivera added 2 commits October 30, 2026 22:24
An image: whose src (or bound value, or computed expression) is a URI now
loads that picture: http(s) through the host's network policy, with
auth: NAME sending the host's credential on the http verbs' terms; file://
relative to the document. The media cache (media.h) fetches, decodes,
downscales and fits off the frame on the app's background pool (a step per
drain in a browser build without threads), shares one fetch between boxes,
evicts idle pictures and retries failures. Widgets draw a placeholder of
their box until the picture arrives and a darker one on failure, with the
reason in the tooltip and at an optional status: key.

- cvc::decode_image: PNG/JPEG/GIF/BMP via stb, WebP via libwebp (now linked
  directly, optional), TIFF/AVIF/HEIC via ImageMagick with the coder named
  from the magic bytes; size caps checked before decoding.
- fit: contain|cover|fill and shape: circle, made by the core so every
  backend draws the raster unchanged; size: [w, h] is a box.
- FTXUI half-blocks honour alpha (a transparent half keeps the terminal's
  background); Backend::drop_image frees an evicted picture (ImGui deletes
  its texture).
- host_get + net_host_access: a host-side GET on the verbs' terms.
- ari/arigl snapshot (and ari test) wait for the pictures a frame drew.
- Tests: ariadne_media_test (decode, fit, cache, widget over a local server
  with a credential and a token scan), ari_media_test (the ari binary),
  ari_run_media_images_{ftxui,tvision} (tmux), cvcgl_imgui_media.
A window, overlay or group may take background: {src|bind, auth, fit,
opacity, terminal, banner_rows, status} (or a bare URL): a picture by URI
through the media cache, or a published image name, drawn behind the
content. The core brackets the content with the new Backend::begin_backdrop
/ end_backdrop; each backend fits the picture to the area the content takes.

- ImGui: the content goes on a draw-list channel above the picture, which is
  drawn (cover/contain/fill UVs, opacity as tint alpha) once the area is
  known: a window's inner rect, a group's rect, full width unless size: says
  otherwise and at least size:'s height.
- FTXUI and tvision: terminal: behind draws dimmed half-blocks under the
  content and turns each cell the content wrote text into readable (the
  picture's colour as background, dimmed to <= 40%, the terminal's own
  foreground); terminal: banner draws the picture as a row above the
  content, in Kitty/Sixel/iTerm pixels once its width is known; none draws
  nothing. No background in mono.
- Tests: loader, core bracketing (ariadne_media_test), FTXUI behind/banner
  layout, ImGui split/merge and the authored height (cvcgl_imgui_media), and
  the tmux test now checks a window background on both terminal backends.
transfix added a commit to cy-pca/nicotina that referenced this pull request Oct 31, 2026
Where the host has background: (transfix/libcvc#932), the profile card has the
account's card_image_url behind it and the window its profile_bg_url, dimmed as
the web app dims them (opacity 0.3 and 0.25). A host without background:
ignores the key. Terminals show neither for now (terminal: none): #932's
half-blocks behind coloured text take the text's colour to the row's end,
reported to that work. Video URLs keep none, by the same rule as the avatar.
The Details window lists the page picture; the stub serves one.
X11 headers define None, so x11_macro_headers_test failed to compile
widget.h. The YAML value stays terminal: none.
Joe Rivera added 6 commits October 31, 2026 00:02
…a reply names

image.url holds in every host that loads a picture by URI, so a document for
older hosts gates its pictures on (has? "image.url") and keeps its own
placeholder elsewhere (an older host prints an unknown URI as text).

A picture whose URL a reply puts in state was drawn as its loading
placeholder by ari snapshot / arigl --terminal snapshot: no frame had asked
for it while the request was out, so the settle loop never waited for it.
AppRuntime::settle_and_render settles, draws, and while that frame drew a
picture still loading, settles and draws again (within the same 10 s).
Test: AriMedia.SnapshotWaitsForAPictureWhoseUrlComesFromAReply.
… the image.background token

A text: with color: wraps its row in a colour decorator, which recoloured
the backdrop's half-blocks after the text (solid bars in the text's colour).
BackdropText now gives a cell that is still the backdrop's own (its
character and background) the picture's foreground back. Test:
MediaBackground.ColouredTextDoesNotPaintTheBackdropBesideIt.
image.background holds where background: draws.
transfix added a commit to cy-pca/nicotina that referenced this pull request Oct 31, 2026
…ances tabs); no Runway (#12)

The profile laid out as the TX.WTF web app's: the banner, the card (avatar, full handle, badges, description, counts, groups, Refresh and Sign out) and Posts, Replies and Balances tabs, in 76x19 so it fits 80x24 in FTXUI and tvision. The confusing Runway row is gone. The account's avatar and header image show where the host has pictures by URL (image.url, transfix/libcvc#931), and its card and page pictures where it has background: (transfix/libcvc#932, ImGui only for now); placeholders elsewhere. Video avatars keep their placeholder, by the web app's rule. Tests: the stub's profile pictures, emblems, presence and user timeline; local txwtf posts and a reply; tabs, paging, no Runway and the 80x24 fit in tmux in both backends.
Joe Rivera added 5 commits October 31, 2026 00:51
…image-url

# Conflicts:
#	src/cvc/ariadne/loader.cpp
…image-url

# Conflicts:
#	src/cvc/ariadne/app_runtime.cpp
…ded wasm (on #914)

With #914's cvc::net::start, the image cache in a browser build without
threads starts a picture's http(s) request (host_get_start: the policy and
auth: on host_get's terms, prepared and completed around cvc::net::start;
else the http handler's resolve_async) and decodes the reply when the
browser hands it over, between frames. host_get_start is host_get,
blocking, where the transport does not start requests.
… clang-format

encode() removed its temporary file while the ifstream reading it was still open. Windows
refuses to delete an open file, so every MediaDecode/MediaCache/MediaWidget case that encodes
a picture threw from std::filesystem::remove there (8 cases in recipe/windows, the same in the
three package-windows builds). The stream now closes first.

Also the changed lines clang-format 18 reformats: ari_media_test.cpp, the two hosts' snapshot
settle calls and two include blocks the master merge touched.
The three MediaBackground cases shared temp/ariadne_media_test_backdrop, and each removed it
when done. ctest runs the cases as separate processes at the same time, so one case removed
(or rewrote) bg.png while another was still loading it; that picture never reached ready and
the case timed out at 5 s. Seen on recipe/ubuntu Debug and Release and on macOS Debug once
the stack above added cases and changed which ones run together. The directory now carries
the running test's name.
#931's changes are already here from its branch, so this keeps this tree
and makes the squash an ancestor, so the branch merges into master.
@transfix
transfix enabled auto-merge (squash) November 2, 2026 05:44
@transfix
transfix merged commit 7d267ce into master Nov 2, 2026
7 of 27 checks passed
@transfix
transfix deleted the feat/ariadne-media-background branch November 2, 2026 06:11
transfix added a commit that referenced this pull request Nov 2, 2026
#932's changes are already here from its branch, so this keeps this tree
and makes the squash an ancestor, so the branch merges into master.
transfix added a commit that referenced this pull request Nov 2, 2026
…932) (#933)

Media M3: cvc://components/card.ari, a generic card (avatar, title,
subtitle, timestamp, body, a media slot and an actions row) built from the
built-in widgets, so it draws in every backend; `slots:` for units; optional
imports ({uri, optional: true}) and `fallback: true` units, so a document can
use the card where the host has it and its own unit where it does not.
transfix added a commit that referenced this pull request Nov 2, 2026
#932 took docs/ARIADNE.md §5.12 for backgrounds; the phone section is
now §5.13.

#932's ImGui backdrop took a group's authored px as device px, so on a
phone (UI size 1.25 at pixel ratio 3) a `size: [auto, 120]` background
came out a quarter of its height. It now goes through ui_px like every
other px a document authors, and cvcgl_imgui_ui_size checks the area at
the phone's scale and at 1 x 1.
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