semanticize method
Semanticize + enrich an already-read scene to detail. The caller
still owns the scene's dispose.
Implementation
Future<SemanticScene> semanticize(
Scene scene, {
SceneDetail detail = SceneDetail.full,
}) async {
final semantic = semanticizer.semanticize(scene, imageCandidates: true);
// Overlay first so overlayLayers is populated before anything renders;
// the rest are order-independent.
await overlayEnricher.enrich(semantic);
await navEnricher.enrich(semantic);
await pagedEnricher.enrich(semantic);
if (detail == SceneDetail.structural) {
ImageEnricher.dropCandidates(semantic);
} else {
await inputEnricher.enrich(semantic);
await toggleEnricher.enrich(semantic);
await flagEnricher.enrich(semantic);
await tabEnricher.enrich(semantic);
await opaqueEnricher.enrich(semantic);
await buttonEnricher.enrich(semantic);
await imageEnricher.enrich(semantic);
}
if (detail == SceneDetail.full) {
await iconEnricher.enrich(semantic);
await linkEnricher.enrich(semantic);
await mapEnricher.enrich(semantic);
}
if (detail != SceneDetail.structural) await inertEnricher.enrich(semantic);
return semantic;
}