Add an option to move the app switcher to the right or bottom, and adjust screen depth if bottom

This commit is contained in:
James Babcock committed 2026-10-01 02:40:13 -07:00
1 parent 46fded856a
commit 8f99779f98
21 files changed
+827 -286

No files matched your search

+8 -3
View File
@@ -10,8 +10,12 @@ export function shellCrop(image: GrayImage, x: number, y: number, width: number,
return { image: crop, x, y, shellKey: key }
}
/** Shared Kotlin receives original 8-bit pixels and quantizes once, before composing. */
export function encodeShellScene(planes: readonly Plane[]): Uint8Array {
/**
* Shared Kotlin receives original 8-bit pixels and quantizes once, before
* composing. `screenDepth` is the whole display's stereo depth (geometry.ts
* uiDepth), trailing the layers.
*/
export function encodeShellScene(planes: readonly Plane[], screenDepth = 0): Uint8Array {
const layers: { image: GrayImage; x: number; y: number; key: number; depth: number; dim: number; selections: Uint8Array[] }[] = []
for (const plane of planes) {
const image = plane.image.withDrawsBaked(false)
@@ -30,10 +34,11 @@ export function encodeShellScene(planes: readonly Plane[]): Uint8Array {
presentation: { ...d.presentation!, depth: d.presentation!.depth + (plane.depth ?? 0) } }))
layers.push({ depth: plane.depth ?? 0, selections, image: cropped.image, x: plane.x + left, y: plane.y + top, key: plane.shellKey!, dim: Math.round((plane.dimUnderneath ?? 1) * 256) })
}
const result = new Uint8Array(2 + layers.reduce((n, l) => n + 16 + l.image.pixels.length + l.selections.reduce((sum, b) => sum + b.length, 0), 0))
const result = new Uint8Array(4 + layers.reduce((n, l) => n + 16 + l.image.pixels.length + l.selections.reduce((sum, b) => sum + b.length, 0), 0))
const view = new DataView(result.buffer); let p = 0
const word = (n: number) => { view.setUint16(p, n, true); p += 2 }
word(layers.length)
for (const l of layers) { word(l.key); word(l.x); word(l.y); word(l.image.width); word(l.image.height); word(l.dim); word(l.selections.length); word(l.depth); result.set(l.image.pixels, p); p += l.image.pixels.length; for (const selection of l.selections) { result.set(selection, p); p += selection.length } }
word(screenDepth)
return result
}