LavaUI docs

enum ScreenshotBridge

Swift

enum ScreenshotBridge

Where a screenshot comes from.

Third of the same shape as ClipboardBridge and DropBridge: a windowed app reads back its own framebuffer, a client has none and asks whoever draws for it. Unset means windowed, so an ordinary app installs nothing.

The agent's protocol is JSON, so it wants base64 — which is why the encoding happens on this side of the wire even though the compositor returns bytes. Nothing about a capture is textual; that is the agent's transport showing through, and the right place for it to show is here.

Sources/LavaUI/AgentServer.swift:29

Properties

nonisolated(unsafe) static var provider: Provider?

Not documented.

Sources/LavaUI/AgentServer.swift:35

Methods

static func captureRegion(x: Int32, y: Int32, w: Int32, h: Int32, editor: Editor) -> [UInt8]?

The same region as PNG bytes, for an app rather than for the agent.

Decoded from the base64 the path above produces, which costs one pass over a few megabytes. Worth it rather than a second capture path: this is called when somebody saves a screenshot, not per frame, and the engine's own capture hands back a C string either way.

Sources/LavaUI/AgentServer.swift:50

Type aliases

typealias Provider = @Sendable (_ x: Int32, _ y: Int32, _ w: Int32, _ h: Int32, _ maxSide: Int32) -> (b64: String, w: Int32, h: Int32)?

Region in framebuffer pixels; returns base64 PNG and its encoded size.

Sources/LavaUI/AgentServer.swift:31