Skip to main content

Module pixels

Module pixels 

Expand description

The pixels of a scene, for an app that reads them: the colour under an eyedropper, a picture being exported.

Where the thread can wait for the GPU, a request is rendered and read back at once. A browser page cannot wait: there the host’s frame loop owns a PixelsHost, which renders each request, has the GPU copy it out and hands the pixels over once the copy has arrived, a few frames later. Callers keep the PixelsRequest, ask for frames while it is_pending and take the answer when it is there, which works the same on every host.

Structs§

Pixels
A scene’s pixels: straight-alpha RGBA rows, top to bottom.
PixelsHost
Renders the requests made on its thread, for a frame loop whose thread cannot wait for the GPU: drive it every frame while it is waiting. Requests made while one exists go to it.
PixelsRequest
The pixels of one scene, on their way. Dropping it gives the request up.

Enums§

PixelsError
Why a scene’s pixels did not come.

Functions§

frame_loop_renders
Whether a frame loop on this thread renders the requests made here (it holds a PixelsHost): a caller that would render on a thread of its own asks it instead, as the frame loop holds the page’s GPU.
request
Ask for the pixels of scene, width x height (at least one each), over background.

Type Aliases§

PixelsAnswer
What a request is answered with.