• Extracts the polyline outline(s) of an AlphaMask's solid region(s) in mask-local coordinates.

    Useful for visualizing what a sprite's pixel-perfect collision footprint actually looks like — a UI overlay that traces the outline of solid pixels rather than the rectangular AABB. Demo 08 uses this to draw the sprite's "real" border.

    Implementation: builds a single-chunk temp bitmap whose interior matches the mask (with 1 px of air padding so the contour closes locally), runs marching squares on it, and applies Douglas-Peucker with epsilon. Output coordinates are in mask-local space ((0, 0) is the mask's top-left corner). Translate by the mask's scene position to draw.

    Parameters

    • mask: AlphaMask
    • epsilon: number = 1

      Douglas-Peucker simplification distance in pixels. Default 1 — same as the destructible-terrain path. Pass 0 to keep every marching-squares vertex.

    Returns Contour[]