Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

dmg: raea's Mac installer window, drawn by raea

shinyobjectz37652ae571a3
diff --git a/tools/release/dmg/background.tiff b/tools/release/dmg/background.tiff
new file mode 100644
index 00000000..f7db3789
Binary files /dev/null and b/tools/release/dmg/background.tiff differ
diff --git a/tools/release/dmg/background.tsx b/tools/release/dmg/background.tsx
new file mode 100644
index 00000000..252a11bb
--- /dev/null
+++ b/tools/release/dmg/background.tsx
@@ -0,0 +1,209 @@
+// raea's installer window (tools/release/dmg/dmg.sh): the picture behind raea.app and the Applications folder in the
+// disk image's Finder window, drawn by raea itself. One WGSL shader over the whole window: paper, a pixel falloff
+// dithered into the corners, raea's cat leaping from the app toward Applications as onion-skinned frames (the pixels
+// thin out behind it, Bayer-dithered), the rest of its arc as dots with a pixel arrowhead, and a second cat asleep in
+// the corner. The line under it is the page's text. Finder draws the icons' names in black over any picture (macOS 27,
+// light or dark appearance), so the window stays paper-light.
+//
+// Finder draws the window at 1x on a plain display and 2x on Retina, from one multi-resolution TIFF, so it renders
+// twice: "dmg-1x" (680x440) and "dmg-2x" (1360x880); dmg.sh joins them with tiffutil. "dmg-loop" is the same scene
+// moving (the cat makes its leap, the other one breathes), for what can move: Finder can't animate a window's picture.
+//
+// raea render background.tsx --composition dmg-2x --frame 0 -o [email protected]
+//
+// Geometry is in the window's points (1x pixels). Finder centres each icon on the point dmg.sh gives it, so APP and
+// APPS here must match dmg.sh's --app-at and --apps-at.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Canvas3D, ShaderMesh, ToneMapping } from "raea/3d";
+import { Camera3d } from "raea/camera";
+import { loadFont } from "raea/text";
+import { Transform } from "raea/transform";
+
+export const W = 680;
+export const H = 440;
+export const APP = [170, 232] as const;
+export const APPS = [510, 232] as const;
+const LINE_Y = 384;
+const LOOP_FPS = 60;
+const LOOP_FRAMES = 180; // 3 s: the leap takes the first 1.1 s, then the cat is gone into Applications and the arc rests
+
+// raea's cat (docs/logo/cat-black.svg on its 36-unit grid, cropped): '#' is ink, its eyes are holes
+const CAT = [
+ "......###.....................", ".....####.....................", "....####......................",
+ "....####......###.............", "....####.....#####.....###....", "....#####....#####....####....",
+ ".....#####..##############....", ".....#####..##############....", "......#####.##############....",
+ "......#####.##############....", "......####################....", ".....#############.####.###...",
+ "....##############.####.###...", "....##############.####.###...", "...########################...",
+ "...########################...", "..#########################...", "..#########################...",
+ "..########################....", "..#######################.....", ".#########################....",
+ ".#########################....", ".##########################...", "######.####################...",
+ "#####....###################..", "#####.....#########...######..", "####......######.......######.",
+ "####......######........#####.", ".##.......#####...........##..", "..........#####...............",
+ "..........#####...............", "...........###................",
+];
+// the other cat, asleep
+const NAP = [
+ ".......................##..", "...#....#...............#..", "...##..##...............#..",
+ "...######.....#######...#..", "..########..#############..", "..#..##..###############...",
+ "..######################...", "...#####################...", "....###################....",
+];
+const ZED = ["#####", "...#.", "..#..", ".#...", "#####"];
+
+/** A '#'/'.' grid as a texture: white where '#', nearest-sampled. */
+function grid(rows: string[]) {
+ const width = rows[0].length;
+ return { width, height: rows.length, pixels: rows.flatMap((r) => [...r].map((c) => (c === "#" ? "#ffffff" : "#000000"))), nearest: true };
+}
+
+const WGSL = /* wgsl */ `
+const PAPER = vec3<f32>(0.980, 0.980, 0.976);
+const INK = vec3<f32>(0.067, 0.067, 0.071);
+const FALL = vec3<f32>(0.918, 0.918, 0.910);
+const TRAIL = vec3<f32>(0.600, 0.600, 0.590);
+const NAPC = vec3<f32>(0.680, 0.680, 0.670);
+
+fn lin(c: vec3<f32>) -> vec3<f32> {
+ return select(pow((c + 0.055) / 1.055, vec3<f32>(2.4)), c / 12.92, c <= vec3<f32>(0.04045));
+}
+
+// 8x8 ordered dither, 0..1: the bit-reversed interleave of x^y and y
+fn bayer(c: vec2<i32>) -> f32 {
+ let x = u32(c.x) & 7u;
+ let y = u32(c.y) & 7u;
+ let v = x ^ y;
+ let b = ((v & 1u) << 5u) | ((y & 1u) << 4u) | ((v & 2u) << 2u) | ((y & 2u) << 1u) | ((v & 4u) >> 1u) | ((y & 4u) >> 2u);
+ return (f32(b) + 0.5) / 64.0;
+}
+
+// the leap: a quadratic from the app's right shoulder, over the gap, down to Applications' left
+fn arc(t: f32) -> vec2<f32> {
+ let a = vec2<f32>(${APP[0] + 70}.0, 196.0);
+ let c = vec2<f32>(${(APP[0] + APPS[0]) / 2}.0, -4.0);
+ let b = vec2<f32>(${APPS[0] - 70}.0, 196.0);
+ let u = 1.0 - t;
+ return u * u * a + 2.0 * u * t * c + t * t * b;
+}
+
+// is the cell of a grid sprite under q set? sprite's top-left at o, cell size k points
+fn cat_at(q: vec2<f32>, o: vec2<f32>, k: f32) -> bool {
+ let g = floor((q - o) / k);
+ if (g.x < 0.0 || g.y < 0.0 || g.x >= 30.0 || g.y >= 32.0) { return false; }
+ return textureLoad(tex_cat, vec2<i32>(g), 0).r > 0.5;
+}
+fn nap_at(q: vec2<f32>, o: vec2<f32>, k: f32) -> bool {
+ let g = floor((q - o) / k);
+ if (g.x < 0.0 || g.y < 0.0 || g.x >= 27.0 || g.y >= 9.0) { return false; }
+ return textureLoad(tex_nap, vec2<i32>(g), 0).r > 0.5;
+}
+fn zed_at(q: vec2<f32>, o: vec2<f32>, k: f32) -> bool {
+ let g = floor((q - o) / k);
+ if (g.x < 0.0 || g.y < 0.0 || g.x >= 5.0 || g.y >= 5.0) { return false; }
+ return textureLoad(tex_zed, vec2<i32>(g), 0).r > 0.5;
+}
+
+fn shade(in: VertexOutput) -> vec4<f32> {
+ let s = u_s();
+ let size = vec2<f32>(${W}.0, ${H}.0) * s;
+ let px = floor(in.uv * size); // the device pixel
+ let q = (px + 0.5) / s; // its centre in points
+ let unit = vec2<i32>(floor(q)); // the 1-point cell the dither reads
+ let phase = u_phase(); // where the hero is on its arc, 0..1
+ var col = PAPER;
+
+ // the falloff: 2-point pixels dithered into the corners, none in the middle
+ let cell = floor(q / 2.0);
+ let e = (cell * 2.0 + 1.0 - vec2<f32>(${W / 2}.0, ${H / 2}.0)) / vec2<f32>(${W / 2}.0, ${H / 2}.0);
+ let r = length(e * vec2<f32>(1.0, 0.92));
+ if (bayer(vec2<i32>(cell)) < smoothstep(0.86, 1.5, r) * 0.5) { col = FALL; }
+
+ let k = 2.0; // the cat's cell, in points
+ let hs = vec2<f32>(15.0, 16.0) * k;
+ let hero = arc(phase);
+
+ // the rest of the arc, ahead of it: 2-point dots and a pixel arrowhead into Applications
+ let ahead = phase + 0.12;
+ for (var i = 0; i < 10; i = i + 1) {
+ let t = ahead + f32(i) * 0.038;
+ if (t > 0.94) { break; }
+ let d = floor(arc(t) / 2.0) * 2.0;
+ if (all(q >= d) && all(q < d + 2.0)) { col = TRAIL; }
+ }
+ let tip = floor(arc(0.975) / 2.0) * 2.0;
+ for (var j = 0; j < 5; j = j + 1) {
+ let a = tip - vec2<f32>(f32(j) * 2.0, 0.0);
+ let b = tip - vec2<f32>(0.0, f32(j) * 2.0);
+ if ((all(q >= a) && all(q < a + 2.0)) || (all(q >= b) && all(q < b + 2.0))) { col = TRAIL; }
+ }
+
+ // onion skins: the frames behind it, thinning out (dithered at 1 point) the further back they are
+ for (var g = 3; g >= 1; g = g - 1) {
+ let t = phase - f32(g) * 0.155;
+ if (t < 0.02 || u_on() < 0.5) { continue; }
+ let o = floor((arc(t) - hs) / k) * k;
+ if (cat_at(q, o, k) && bayer(unit) < 0.62 - f32(g) * 0.16) { col = INK; }
+ }
+ // and the cat itself
+ if (u_on() > 0.5 && cat_at(q, floor((hero - hs) / k) * k, k)) { col = INK; }
+
+ // the one asleep in the corner, breathing, with its z's
+ let breath = u_breath();
+ let no = vec2<f32>(${W - 108}.0, ${H - 52}.0 - floor(breath * 2.0 + 0.5));
+ if (nap_at(q, no, 3.0)) { col = NAPC; }
+ // each z rises from the head and thins out (dithered) as it goes
+ let z1 = fract(u_zed());
+ let z2 = fract(u_zed() + 0.5);
+ if (zed_at(q, no + vec2<f32>(-2.0 - floor(z1 * 10.0), -12.0 - floor(z1 * 18.0)), 2.0) && bayer(unit) < 1.25 - z1) { col = NAPC; }
+ if (zed_at(q, no + vec2<f32>(-14.0 - floor(z2 * 10.0), -26.0 - floor(z2 * 18.0)), 3.0) && bayer(unit) < 1.25 - z2) { col = NAPC; }
+
+ return vec4<f32>(lin(col), 1.0);
+}`;
+
+const TEX = { cat: grid(CAT), nap: grid(NAP), zed: grid(ZED) };
+
+/** Where the cat is on frame f of the loop: a leap with an eased take-off and landing, then gone (in Applications). */
+function leapAt(f: number) {
+ const t = f / (LOOP_FPS * 1.1);
+ if (t >= 1) return { phase: 1, on: 0 };
+ const e = t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
+ return { phase: 0.02 + 0.96 * e, on: 1 };
+}
+
+function Window({ s, moving }: { s: number; moving?: boolean }) {
+ const f = useCurrentFrame();
+ const { fontFamily } = loadFont("Geist");
+ // the still: the cat at the top of its leap, the z's mid-rise
+ const pose = moving ? leapAt(f) : { phase: 0.52, on: 1 };
+ const breath = moving ? (1 - Math.cos((f / LOOP_FPS) * Math.PI * 2 * 0.5)) / 2 : 0;
+ const zed = moving ? (f / LOOP_FRAMES) * 2 : 0.15;
+ return (
+ <AbsoluteFill style={{ background: "#fafaf9" }}>
+ <Canvas3D layered>
+ <Camera3d transform={Transform.fromXyz(0, 0, 5).lookingAt([0, 0, 0])} projection={{ Orthographic: { scaling_mode: { FixedVertical: { viewport_height: 1 } } } }} />
+ <ToneMapping mode="none" />
+ <ShaderMesh
+ shape={{ primitive: "Rectangle", half_size: [W / H / 2, 0.5] }}
+ wgsl={WGSL}
+ uniforms={{ s, phase: pose.phase, on: pose.on, breath, zed }}
+ textures={TEX}
+ />
+ </Canvas3D>
+ <div
+ style={{
+ position: "absolute", left: 0, right: 0, top: (LINE_Y - 9) * s, textAlign: "center", fontFamily,
+ fontSize: 13 * s, lineHeight: `${18 * s}px`, fontWeight: 500, letterSpacing: "-0.01em", color: "#8a8a87",
+ opacity: 1, transform: "scale(1)",
+ }}
+ >
+ Drag raea into Applications
+ </div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => (
+ <>
+ <Composition id="dmg-1x" component={() => <Window s={1} />} durationInFrames={1} fps={30} width={W} height={H} />
+ <Composition id="dmg-2x" component={() => <Window s={2} />} durationInFrames={1} fps={30} width={W * 2} height={H * 2} />
+ <Composition id="dmg-loop" component={() => <Window s={2} moving />} durationInFrames={LOOP_FRAMES} fps={LOOP_FPS} width={W * 2} height={H * 2} />
+ </>
+));
diff --git a/tools/release/dmg/check.sh b/tools/release/dmg/check.sh
new file mode 100755
index 00000000..925edf41
--- /dev/null
+++ b/tools/release/dmg/check.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# Checks a disk image dmg.sh made, as a person's Mac will open it: mounted read-only, its files (the app, the
+# Applications link, the picture, the volume's icon and its flag, the layout naming the picture), then its window as
+# Finder lays it out, read back from Finder (bounds, icon view, toolbar, icon size, where each icon sits), against
+# what dmg.sh set.
+# Opens the window on this Mac's screen for a moment, and ejects the image after. Exits 1 on the first mismatch.
+# tools/release/dmg/check.sh RAEA.dmg [--keep-open]
+set -euo pipefail
+dmg=${1:?usage: check.sh RAEA.dmg [--keep-open]}
+keep=; [ "${2:-}" = --keep-open ] && keep=1
+fail() { echo "FAIL check: $*" >&2; exit 1; }
+mnt=$(hdiutil attach -readonly -noverify -noautoopen "$dmg" 2>/dev/null | awk -F'\t' '/Apple_HFS/ {print $NF; exit}')
+[ -n "$mnt" ] || fail "$dmg didn't mount"
+[ -n "$keep" ] || trap 'osascript -e "tell application \"Finder\" to close (every window whose name is \"$vol\")" >/dev/null 2>&1 || true; hdiutil detach "$mnt" -quiet || hdiutil detach "$mnt" -force -quiet' EXIT
+vol=$(basename "$mnt")
+app=$(cd "$mnt" && ls -d -- *.app | head -1)
+[ -n "$app" ] || fail "no app in $mnt"
+[ "$(readlink "$mnt/Applications")" = /Applications ] || fail "Applications isn't a link to /Applications"
+[ -f "$mnt/.background/background.tiff" ] || fail "no .background/background.tiff"
+[ "$(tiffutil -info "$mnt/.background/background.tiff" | grep -c 'Image Width')" = 2 ] || fail "the picture isn't 1x and 2x"
+[ -f "$mnt/.VolumeIcon.icns" ] || fail "no .VolumeIcon.icns"
+GetFileInfo -aC "$mnt" | grep -qx 1 || fail "the volume's custom-icon flag is off: Finder shows a plain disk"
+[ -f "$mnt/.DS_Store" ] || fail "no .DS_Store: the window has no layout"
+# Finder won't hand the background picture to AppleScript (macOS 27), so it's read from the layout: its bookmark
+strings -a "$mnt/.DS_Store" | grep -qx "/.background/background.tiff" || fail "the window's layout names no background.tiff"
+codesign --verify --deep --strict "$mnt/$app" 2>/dev/null && signed="signed app" || signed="unsigned app"
+layout=$(osascript - "$vol" "$app" <<'AS'
+on run argv
+ set volName to item 1 of argv
+ set appName to item 2 of argv
+ tell application "Finder"
+ open disk volName
+ set w to container window of disk volName
+ set o to icon view options of w
+ set b to bounds of w
+ set p1 to position of item appName of w
+ set p2 to position of item "Applications" of w
+ return "view " & (current view of w as string) & "; toolbar " & (toolbar visible of w) & "; size " & ((item 3 of b) - (item 1 of b)) & "x" & ((item 4 of b) - (item 2 of b)) & "; icons " & (icon size of o) & "; app " & (item 1 of p1) & "," & (item 2 of p1) & "; Applications " & (item 1 of p2) & "," & (item 2 of p2)
+ end tell
+end run
+AS
+)
+echo "window: $layout"
+want="view icon view; toolbar false; size 680x468; icons 128; app 170,232; Applications 510,232"
+[ "$layout" = "$want" ] || fail "the window isn't laid out as dmg.sh sets it: want \"$want\""
+echo "ok $dmg: $vol, $app ($signed), the window as laid out"
diff --git a/tools/release/dmg/dmg.sh b/tools/release/dmg/dmg.sh
new file mode 100755
index 00000000..f5a3733b
--- /dev/null
+++ b/tools/release/dmg/dmg.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+# raea's Mac download as a disk image: raea.app beside a link to Applications in a Finder window laid out over
+# raea's own picture (background.tiff, which raea renders from background.tsx: render.sh), with the app's icon as the
+# volume's. A person opens it, drags the cat onto Applications, and raea runs from there (not from Downloads, where
+# macOS runs a quarantined app translocated and read-only, so it can't update itself).
+#
+# tools/release/dmg/dmg.sh APP.app OUT.dmg [--volname NAME] [--sign IDENTITY [--keychain KC]] [--notarize ENV]
+#
+# APP.app goes in as it is (ditto keeps its signature and stapled ticket). --sign signs the image with that Developer
+# ID; --notarize ENV (a file setting ASC_KEY_PATH, ASC_KEY_ID and ASC_ISSUER_ID) notarizes and staples the signed image.
+# Writes OUT.dmg and OUT.dmg.sha256. Finder writes the window's layout (.DS_Store) when layout.applescript asks it to,
+# so this runs on a Mac in a logged-in session: the window opens and closes once while it's built.
+# RAEA_DMG_FORMAT picks the compression (ULFO, lzfse, by default: macOS 10.11 and later, fast to verify and open).
+set -euo pipefail
+here="$(cd "$(dirname "$0")" && pwd)"
+usage="usage: dmg.sh APP.app OUT.dmg [--volname NAME] [--sign IDENTITY [--keychain KC]] [--notarize ENV]"
+app=${1:?$usage}
+out=${2:?$usage}
+vol="Install raea"
+identity=
+keychain=
+notary=
+shift 2
+while [ $# -gt 0 ]; do
+ case $1 in
+ --volname) vol=${2:?$usage}; shift 2 ;;
+ --sign) identity=${2:?$usage}; shift 2 ;;
+ --keychain) keychain=${2:?$usage}; shift 2 ;;
+ --notarize) notary=${2:?$usage}; shift 2 ;;
+ *) echo "dmg: unknown option $1" >&2; exit 1 ;;
+ esac
+done
+die() { echo "FAIL dmg: $*" >&2; exit 1; }
+[ -d "$app/Contents" ] || die "$app isn't an app bundle"
+[ -z "$notary" ] || [ -n "$identity" ] || die "--notarize needs --sign: Apple notarizes a signed image"
+[ -f "$here/background.tiff" ] || die "no $here/background.tiff (render.sh makes it)"
+[ ! -e "/Volumes/$vol" ] || die "a volume named \"$vol\" is mounted: eject it first, or Finder would lay out the wrong window"
+format=${RAEA_DMG_FORMAT:-ULFO}
+
+# the window, in points: the picture's size, and where Finder centres each icon on it (background.tsx's APP and APPS)
+win_w=680; win_h=440
+app_at=(170 232); apps_at=(510 232)
+icon_px=128; text_px=13
+
+name=$(basename "$app")
+plist="$app/Contents/Info.plist"
+icon=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIconFile" "$plist" 2>/dev/null || true)
+[ -n "$icon" ] || die "$plist names no CFBundleIconFile"
+icon="$app/Contents/Resources/${icon%.icns}.icns"
+[ -f "$icon" ] || die "no icon at $icon"
+
+work=$(mktemp -d)
+dev=
+cleanup() {
+ if [ -n "$dev" ]; then hdiutil detach "$dev" -quiet 2>/dev/null || hdiutil detach "$dev" -force -quiet 2>/dev/null || true; fi
+ rm -rf "${work:?}"
+}
+trap cleanup EXIT
+
+# a writable image a little larger than the app, attached where Finder sees it (no -nobrowse: AppleScript needs it)
+mb=$(( $(du -sm "$app" | cut -f1) * 11 / 10 + 40 ))
+rw="$work/rw.dmg"
+hdiutil create -quiet -size "${mb}m" -fs HFS+ -volname "$vol" "$rw"
+mnt=$(hdiutil attach -readwrite -noverify -noautoopen "$rw" 2>/dev/null | awk -F'\t' '/Apple_HFS/ {print $NF; exit}')
+dev=$mnt # detached by its mount point
+[ "$mnt" = "/Volumes/$vol" ] || die "attached at \"$mnt\", not /Volumes/$vol"
+
+ditto "$app" "$mnt/$name"
+ln -s /Applications "$mnt/Applications"
+mkdir "$mnt/.background"
+cp "$here/background.tiff" "$mnt/.background/background.tiff"
+
+echo "layout: $(osascript "$here/layout.applescript" "$vol" background.tiff "$win_w" "$win_h" "$name" \
+ "${app_at[0]}" "${app_at[1]}" "${apps_at[0]}" "${apps_at[1]}" "$icon_px" "$text_px")"
+[ -f "$mnt/.DS_Store" ] || die "Finder wrote no .DS_Store: is this a logged-in session, and may this terminal control Finder?"
+
+# the volume's icon after the layout: Finder (macOS 27) deletes a .VolumeIcon.icns, and clears the custom-icon flag,
+# when it opens a volume that has them
+cp "$icon" "$mnt/.VolumeIcon.icns"
+SetFile -c icnC "$mnt/.VolumeIcon.icns"
+SetFile -a C "$mnt"
+
+rm -rf "${mnt:?}/.fseventsd" "${mnt:?}/.Trashes"
+chmod -Rf go-w "$mnt" 2>/dev/null || true
+sync
+hdiutil detach "$dev" -quiet || hdiutil detach "$dev" -force -quiet
+dev=
+
+mkdir -p "$(dirname "$out")"
+rm -f "$out"
+hdiutil convert -quiet "$rw" -format "$format" -o "$out"
+
+if [ -n "$identity" ]; then
+ codesign --force --timestamp ${keychain:+--keychain "$keychain"} -s "$identity" "$out"
+ codesign --verify --strict "$out"
+fi
+if [ -n "$notary" ]; then
+ set -a; . "$notary"; set +a
+ xcrun notarytool submit "$out" --key "$ASC_KEY_PATH" --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" --wait \
+ --output-format json | tee "$work/notary.json"
+ grep -q '"status" *: *"Accepted"' "$work/notary.json" || die "notarization: $(cat "$work/notary.json")"
+ xcrun stapler staple "$out"
+ spctl --assess --type open --context context:primary-signature -vv "$out" 2>&1 | head -3
+fi
+# the file's own name, so `shasum -a 256 -c` works beside a download
+(cd "$(dirname "$out")" && shasum -a 256 "$(basename "$out")") > "$out.sha256"
+echo "ok $out ($(du -h "$out" | cut -f1), $format$([ -n "$identity" ] && echo ", signed")$([ -n "$notary" ] && echo ", notarized"))"
diff --git a/tools/release/dmg/layout.applescript b/tools/release/dmg/layout.applescript
new file mode 100644
index 00000000..dbe369e5
--- /dev/null
+++ b/tools/release/dmg/layout.applescript
@@ -0,0 +1,49 @@
+-- The installer window's layout (dmg.sh): Finder opens the mounted volume VOL, hides the toolbar and status bar,
+-- sizes the window, sets icon view with the background picture, the icon and text size, and puts the app and the
+-- Applications link where the background expects them. Finder keeps all of it in the volume's .DS_Store, which is
+-- what a person's Finder reads when they open the disk image. Printed: the window's bounds and each item's position,
+-- read back from Finder after it reopens the window.
+-- osascript layout.applescript VOL BACKGROUND W H APP APP_X APP_Y APPS_X APPS_Y ICON_PX TEXT_PX
+on run argv
+ set volName to item 1 of argv
+ set bgName to item 2 of argv
+ set winW to (item 3 of argv) as integer
+ set winH to (item 4 of argv) as integer
+ set appName to item 5 of argv
+ set appX to (item 6 of argv) as integer
+ set appY to (item 7 of argv) as integer
+ set lnX to (item 8 of argv) as integer
+ set lnY to (item 9 of argv) as integer
+ set iconPx to (item 10 of argv) as integer
+ set textPx to (item 11 of argv) as integer
+ -- a window's bounds include its title bar: 28 points to macOS 15, 32 on 26. The picture is drawn from the content's
+ -- top left, so 28 shows all of it on the older ones and crops 4 points of plain paper on the newer.
+ set titleBar to 28
+ tell application "Finder"
+ tell disk volName
+ open
+ set current view of container window to icon view
+ set toolbar visible of container window to false
+ set statusbar visible of container window to false
+ set the bounds of container window to {160, 120, 160 + winW, 120 + winH + titleBar}
+ set opts to the icon view options of container window
+ set arrangement of opts to not arranged
+ set icon size of opts to iconPx
+ set text size of opts to textPx
+ set shows item info of opts to false
+ set shows icon preview of opts to false
+ set background picture of opts to file (".background:" & bgName)
+ set position of item appName of container window to {appX, appY}
+ set position of item "Applications" of container window to {lnX, lnY}
+ close
+ open
+ update without registering applications
+ delay 1
+ set b to bounds of container window
+ set p1 to position of item appName of container window
+ set p2 to position of item "Applications" of container window
+ close
+ end tell
+ end tell
+ return "bounds " & (item 1 of b) & "," & (item 2 of b) & "," & (item 3 of b) & "," & (item 4 of b) & "; " & appName & " " & (item 1 of p1) & "," & (item 2 of p1) & "; Applications " & (item 1 of p2) & "," & (item 2 of p2)
+end run
diff --git a/tools/release/dmg/render.sh b/tools/release/dmg/render.sh
new file mode 100755
index 00000000..d4f4c11b
--- /dev/null
+++ b/tools/release/dmg/render.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# The installer window's picture, rendered by raea from background.tsx: the 1x and 2x stills joined into one
+# multi-resolution TIFF (background.tiff, which dmg.sh puts in the image), so Finder draws it sharp on any display.
+# With --loop OUT.mp4 it also renders the same scene moving (the leap, 3 s at 60 fps), for places that can play it:
+# Finder only ever shows a window's picture still.
+# tools/release/dmg/render.sh [--loop OUT.mp4]
+set -euo pipefail
+here="$(cd "$(dirname "$0")" && pwd)"
+loop=
+[ "${1:-}" = --loop ] && loop=${2:?usage: render.sh [--loop OUT.mp4]}
+work=$(mktemp -d)
+trap 'rm -rf "${work:?}"' EXIT
+raea render "$here/background.tsx" --composition dmg-1x --frame 0 -o "$work/background.png"
+raea render "$here/background.tsx" --composition dmg-2x --frame 0 -o "$work/[email protected]"
+# Finder reads the 2x picture as 144 dpi
+sips -s dpiWidth 72 -s dpiHeight 72 "$work/background.png" >/dev/null
+sips -s dpiWidth 144 -s dpiHeight 144 "$work/[email protected]" >/dev/null
+tiffutil -cathidpicheck "$work/background.png" "$work/[email protected]" -out "$here/background.tiff"
+tiffutil -info "$here/background.tiff" | grep -E "Image Width|Resolution:"
+if [ -n "$loop" ]; then
+ raea render "$here/background.tsx" --composition dmg-loop -o "$loop" --quality master
+fi
+echo "ok $here/background.tiff"