Manages multiple textures packed into a single large texture for performance.
AtlasStats GetStats() const
const AtlasRegion * GetRegion(int source_id) const
Get region for a specific source.
absl::Status PackBitmap(const Bitmap &src, const AtlasRegion ®ion)
Pack a bitmap into an allocated region.
Bitmap & GetAtlasBitmap()
Get the atlas bitmap (contains all packed textures)
void FreeRegion(int source_id)
Free a region and mark it as available.
const Bitmap & GetAtlasBitmap() const
void Clear()
Clear all regions and reset atlas.
absl::Status DrawRegion(int source_id, int dest_x, int dest_y)
Draw a region from the atlas to screen coordinates.
AtlasRegion * AllocateRegion(int source_id, int width, int height)
Allocate a region in the atlas for a source texture.
bool TryPackRect(int width, int height, int &out_x, int &out_y)
std::map< int, AtlasRegion > regions_
Region within the atlas texture.
Get atlas utilization statistics.