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.
- Pixels
Host - Renders the requests made on its thread, for a frame loop whose thread
cannot wait for the GPU:
driveit every frame while it iswaiting. Requests made while one exists go to it. - Pixels
Request - The pixels of one scene, on their way. Dropping it gives the request up.
Enums§
- Pixels
Error - 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,widthxheight(at least one each), overbackground.
Type Aliases§
- Pixels
Answer - What a request is answered with.