class

ContributorMural::Renderers::PixelLattice

Inherits ContributorMural::Renderer < Reference < Object

A picture drawn on a lattice of pixels, one avatar per lit pixel: what stencil does with a word and silhouette does with an image. Each subclass says which pixels are lit and in what order they fill; everything about seating people on them lives here. Every pixel still waiting for someone shows a faint dot, so the picture is legible from the first contributor and finishes itself as more arrive.

People are handed out one per pixel in fill order before any pixel gets a second, and a pixel holding several splits into its own small grid. That ordering is what keeps the picture from ever looking emptier after someone joins — the failure mode of resizing every pixel at once.

Constants

GHOST_OPACITY = 0.38
GHOST_RATIO = 0.62

Dot diameter as a share of its slot. A full-size disc reads as a wall of broken images, but too small a dot stops joining up into strokes and the picture becomes unreadable — which is the whole job the ghosts are here for.

Instance methods

fetch_size(user : ResolvedUser) : Int32

Pixel size at which to fetch this user's avatar (2x render size for crisp display on high-DPI screens).

Source
prepare(users : Array(ResolvedUser)) : Nil

Sections draw the same picture independently, so size each person against each section they are drawn in — bucketed by sections, the way Resolver.grouped fills them, so someone who is also in a small section is not fetched for the crowded one alone. Where their seats differ, the fetch follows the largest, since a face drawn smaller than it was fetched is only wasted bytes and one drawn larger is blurred.

Source

Nested types