← back to roto on ba3a.dev

AtlasParser

Reads the libGDX TexturePacker text format and rebuilds frames from it. Pure over the atlas text and page rasters; the caller loads the page PNGs.

A region that is rotated on its page is refused, naming the region: TexturePacker does not rotate by default.

Functions

Link copied to clipboard
fun parse(text: String): List<AtlasPage>

Parses text into pages and regions; a malformed file, or a rotated region, fails with a ModelException.

Link copied to clipboard
fun rebuild(region: AtlasRegion, page: Raster): Raster

The frame of region at its original size, cut from page: the crop is placed AtlasRegion.offsetX from the left and AtlasRegion.offsetY up from the bottom (libGDX measures the offset from the bottom-left corner), the rest is transparent.