Table of Contents

Interface IAtlasPacker

Namespace
KernSmith.Atlas
Assembly
KernSmith.dll

Packs glyph rectangles into texture atlas pages using a bin-packing algorithm.

public interface IAtlasPacker

Methods

Pack(IReadOnlyList<GlyphRect>, int, int)

Packs glyphs into pages that fit within the given max size.

PackResult Pack(IReadOnlyList<GlyphRect> glyphs, int maxWidth, int maxHeight)

Parameters

glyphs IReadOnlyList<GlyphRect>

The glyph sizes to pack.

maxWidth int

Max page width in pixels.

maxHeight int

Max page height in pixels.

Returns

PackResult

Where each glyph was placed and how many pages were needed.

PackInto(IReadOnlyList<GlyphRect>, IReadOnlyList<OccupiedRect>, int, int, int)

Packs new glyphs into pages of the given size where the occupied regions are already taken. Existing regions are never moved; new pages may be added beyond pageCount if the new glyphs don't fit. The returned Placements cover only newGlyphs.

PackResult PackInto(IReadOnlyList<GlyphRect> newGlyphs, IReadOnlyList<OccupiedRect> occupied, int pageCount, int maxWidth, int maxHeight)

Parameters

newGlyphs IReadOnlyList<GlyphRect>

The new glyph sizes to place.

occupied IReadOnlyList<OccupiedRect>

Regions already taken by existing glyphs.

pageCount int

Number of existing pages.

maxWidth int

Page width in pixels.

maxHeight int

Page height in pixels.

Returns

PackResult

Where each new glyph was placed and the total page count after packing.

Exceptions

NotSupportedException

The packer does not support incremental packing (the default).