Skip to main content

Module tiles

Module tiles 

Source
Expand description

Tiles: squares of a drawing, 256 device pixels a side, painted at one scale in one theme — where each is in the design, the pyramid’s levels, and the cache that keeps them and marks the ones damage makes stale.

Structs§

Cache
Painted tiles, keyed by theme, level, column and row, holding at most cap of cost — bytes of pixels, or a count — the least recently used dropped first. Damage marks the tiles it overlaps stale; a stale tile is still there, and says so, until it is painted again. What a tile holds is the cache’s user’s: pixels in the server, a texture on the GPU.
Key
A tile: its theme, its level, and its column and row from the drawing’s top-left.
Level
A scale tiles are painted at, to a 1/1024th: a level of the pyramid.
View
A view of a drawing: width × height device pixels showing the drawing scaled by zoom, its top-left at origin, a whole device pixel.

Constants§

TILE
A tile’s side, in device pixels.

Traits§

Tiled
What a cache keys its tiles by: a tile’s Key, with whatever else tells the cache’s tiles apart — a server’s design, say.

Functions§

square
The design-coordinate square of tile (col, row) at scale of a drawing whose top-left is origin.
tile_rect
The design-coordinate square of tile (col, row) at scale, from the drawing’s top-left.