Raster

from acron.hud import Raster
class Raster(width: int, height: int, *, name: str = 'raster')

Bases: Painter

An RGBA raster you draw into, on a card.

Coordinates are a 2D drawing API’s: (x, y) with y growing DOWN from the top-left. Primitives composite “over” with about a pixel of anti-aliasing, computed on the primitive’s bounding box only, so a stroke costs its own size and not the raster’s.

The pixels live in the engine: acron.raster.RasterPainter (C++), which C++ games use directly. The store is bytes, in Acron’s own layout — BGRA, bottom row first, premultiplied — rather than a float image converted on the way out. None of that is micro-optimisation. An instrument redraws every frame and Acron re-sends the whole texture on any change (RUNTIME rule 17), so:

  • keeping bytes makes upload() a memcpy rather than a conversion of the whole image;

  • premultiplying makes “over” a single lerp — dst = src*a + dst*(1-a) across all four channels — instead of a per-channel composite with a divide. The card is drawn with M_premultiplied_alpha to match.

The cost is that compositing rounds to 8 bits per layer, which for two or three HUD layers is invisible and for a deep stack would not be — that is what pixel() / pixels() are for when a test wants the image back as floats.

lines() and polyline() take the union of their segments’ coverage and composite it once, so a trace’s joints and a graticule’s crossings do not darken.

Nothing reaches the GPU until upload(), which is a no-op when nothing was drawn since the last one.

Inheritance diagram

digraph inheritancef465038ce9 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "Painter" [URL="acron.hud.Painter.html#acron.hud.Painter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="The drawing calls an instrument makes — raster pixels, y growing DOWN."]; "Raster" [URL="acron.hud.Raster.html#acron.hud.Raster",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="An RGBA raster you draw into, on a card."]; "Painter" -> "Raster" [arrowsize=0.75,style=""]; }
property data: bytes

BGRA, bottom row first, premultiplied.

Type:

The store itself

property dirty: bool
labels: LabelPool | None

Text sink, created by attach(); text() is a no-op without one, which is what a headless raster wants.

painter

BGRA, bottom row first, premultiplied — a Acron RAM image, written in place.

Type:

The native painter