displayBackdrops function

List<int> displayBackdrops(
  1. ThemeSpec spec
)

Everything display text may be drawn on: the surface (composited over the background when translucent) plus backgroundSamples. A 7-segment LCD theme (TypeSpec.lcd) draws its display on the opaque LCD panel only, so the panel is its one backdrop.

Implementation

List<int> displayBackdrops(ThemeSpec spec) {
  final bgs = backgroundSamples(spec.background);
  final surface = spec.palette.surface;
  if (spec.type.lcd) {
    return ((surface >>> 24) & 0xFF) == 255
        ? [surface]
        : [compositeOver(surface, bgs.first)];
  }
  final surfaces = ((surface >>> 24) & 0xFF) == 255
      ? [surface]
      : [for (final b in bgs) compositeOver(surface, b)];
  // Liquid Glass draws every display text on its solid-enough backing
  // panel (the surface over the background), never on the bare mesh; the
  // newer families say what their display text sits on themselves.
  if (spec.family == ThemeFamily.liquidGlass) return surfaces;
  final own = switch (spec.family) {
    ThemeFamily.claymorphism => claymorphismDisplayBackdrops(
      spec,
      surfaces,
      bgs,
    ),
    ThemeFamily.y2kChrome => y2kAeroDisplayBackdrops(spec, surfaces, bgs),
    ThemeFamily.paperInk => paperInkDisplayBackdrops(spec, surfaces, bgs),
    ThemeFamily.cyberpunk => cyberpunkDisplayBackdrops(spec, surfaces, bgs),
    ThemeFamily.vaporwave => vaporwaveDisplayBackdrops(spec, surfaces, bgs),
    ThemeFamily.bauhaus => bauhausDisplayBackdrops(spec, surfaces, bgs),
    _ => null,
  };
  return own ?? [...surfaces, ...bgs];
}