Skip to content

ITextureAtlasBuilder Interface

Definition

Namespace: Brine2D.Rendering.TextureAtlas

Builder for creating texture atlases from individual textures. Follows ASP.NET's fluent builder pattern for a familiar developer experience. Automatically splits into multiple atlases if textures don't fit in one atlas.

C#
public interface ITextureAtlasBuilder

Derived
TextureAtlasBuilder

Methods
AddFolder\(string, string, bool\) Adds all textures from a folder to be packed into the atlas.
AddTexture\(string, string\) Adds a texture to be packed into the atlas.
BuildAsync\(CancellationToken\) Builds the texture atlas collection asynchronously. Loads all added textures, packs them, and creates atlas\(es\). Automatically creates multiple atlases if textures don't fit in one.
Clear() Clears all added textures and resets builder state.
WithExtrude\(int\) Enables edge extrusion: duplicates each sprite's outermost pixels into the surrounding padding by pixels pixels to prevent transparent-edge bleed when using linear \(bilinear\) filtering. Requires WithPadding to be at least as large as this value.
WithMaxSize\(int, int\) Sets the maximum size for each atlas texture.
WithName\(string\) Sets the name for the atlas being built.
WithPadding\(int\) Sets the padding between sprites in the atlas. Padding prevents texture bleeding when using bilinear filtering.
WithPowerOfTwo\(bool\) Sets whether to use power-of-two dimensions for the atlas. Power-of-two textures are more compatible with older GPUs.
WithScaleMode\(TextureScaleMode\) Sets the texture scale mode for the atlas.