attachOffscreen method
- OffscreenDescriptor descriptor,
- RenderSessionAttachOptions options, {
- OffscreenDeviceHandle? device,
Attaches a render session that renders the map offscreen.
Read each image's pixels with RenderSessionHandle.readTexture().
The session renders on device. When device is null, the session
creates a device with the default options, and releases it when the
session ends.
See mln_map_attach_offscreen in the
C API reference.
Errors:
Status.invalidStatewhen the map already has a render session.Status.nativeErrorwhendeviceis null and the platform can't create a device.
Implementation
RenderSessionHandle attachOffscreen(
OffscreenDescriptor descriptor,
RenderSessionAttachOptions options, {
OffscreenDeviceHandle? device,
}) {
final registrations = _NativeRegistrations(_CallbackRoots());
return _attach(
(arena, completion, outSession) => registrations.run(
() => raw.mln_map_attach_offscreen(
_handle.raw,
_writeOffscreenDescriptor(descriptor, arena),
_writeRenderSessionAttachOptions(options, arena, registrations),
(device?._handle.raw ?? 0),
outSession,
completion,
nativeDiagnostic,
),
),
(handle, ready) => _adoptOwned(
handle,
() =>
(RenderSessionHandle._(this, _NativeRenderSession(handle), ready)
.._state.retain(registrations)),
(handle) {
_check(raw.mln_render_session_dispose(handle, nativeDiagnostic));
},
),
);
}