FramePresenter typedef
The shape of presentFrame, and of every presenter a backend registers.
A parameter of SceneSurface rather than a call it makes: presentFrame
is picked by a conditional export between backend_native.dart and
backend_web.dart, and a caller that wants to show a frame some other way
— a test with no backend, a presenter of its own — passes that instead.
A caller that does not simply passes presentFrame.
What a frame is shown as travels with the frame, not with the call. A
function type cannot gain a parameter within a major, so a presenter that
shows high dynamic range or wide gamut (DeviceFeature.presenterColorSpaces)
will read the frame's colour space from the texture it is handed: a field
added to TextureDescriptor when that presentation arrives, carried on the
TextureHandle beside its format, sRGB by default. This shape stays as
it is through 1.x.
A frame whose alpha is below one shows what is behind it, premultiplied
on all four presenters (Impeller, WebGL2, WebGPU, the CPU's): the frame's
colour is already multiplied by its alpha, which is what a multisampled
edge over a transparent clear resolves to. The alpha mode travels on the
frame's TextureDescriptor beside its colour space, premultiplied by
default; a capture is opaque unless asked otherwise, and a minor adds the
option.
Implementation
typedef FramePresenter =
Widget Function(
GraphicsDevice device,
TextureHandle frame, {
BoxFit fit,
FilterQuality quality,
});