SdfAtlasManager

actual class SdfAtlasManager(atlasWidth: Int, atlasHeight: Int)

Android implementation of SDF atlas manager for text rendering.

Manages two atlas bitmaps:

  • Normal atlas: Pre-processed alpha for crisp text edges

  • Shadow atlas: Pre-processed alpha for smooth shadow/glow effects

SDF processing is performed in Rust for optimal performance:

  • A channel: normal text alpha

  • G channel: shadow alpha

Parameters

atlasWidth

Width of the atlas texture in pixels

atlasHeight

Height of the atlas texture in pixels

expect class SdfAtlasManager(atlasWidth: Int, atlasHeight: Int)

Manages the SDF atlas texture for text rendering. This is a platform-specific implementation that handles:

  • Atlas texture creation and updates

  • Drawing glyphs from the atlas using SDF techniques

actual class SdfAtlasManager(atlasWidth: Int, atlasHeight: Int)

JVM/Desktop implementation of SDF atlas manager for text rendering.

Manages two atlas images:

  • Normal atlas: Pre-processed alpha for crisp text edges

  • Shadow atlas: Pre-processed alpha for smooth shadow/glow effects

SDF processing is performed in Rust for optimal performance:

  • A channel: normal text alpha

  • G channel: shadow alpha

Parameters

atlasWidth

Width of the atlas texture in pixels

atlasHeight

Height of the atlas texture in pixels

Constructors

Link copied to clipboard
actual constructor(atlasWidth: Int, atlasHeight: Int)
expect constructor(atlasWidth: Int, atlasHeight: Int)
actual constructor(atlasWidth: Int, atlasHeight: Int)

Properties

Link copied to clipboard
actual val height: Int
expect val height: Int

The height of the atlas texture in pixels.

actual val height: Int
Link copied to clipboard
actual val width: Int
expect val width: Int

The width of the atlas texture in pixels.

actual val width: Int

Functions

Link copied to clipboard
actual fun clearFallbackFonts()

Clears fallback fonts. No-op: use NativeTextEngine.clearFallbackFonts instead.

expect fun clearFallbackFonts()

Clears all loaded fallback fonts.

actual fun clearFallbackFonts()

Clears fallback fonts. No-op: use NativeTextEngine.clearFallbackFonts instead.

Link copied to clipboard
actual fun destroy()

Releases all resources associated with the atlas.

expect fun destroy()

Releases all resources associated with the atlas.

actual fun destroy()

Releases all resources associated with the atlas.

Link copied to clipboard
actual fun DrawScope.drawGlyph(atlasRect: Rect, destOffset: Offset, destSize: Size, color: Color, shadow: Shadow?)

Draws a glyph from the atlas to the canvas with optional shadow.

expect fun ERROR CLASS: Symbol not found for DrawScope.drawGlyph(atlasRect: ERROR CLASS: Symbol not found for Rect, destOffset: ERROR CLASS: Symbol not found for Offset, destSize: ERROR CLASS: Symbol not found for Size, color: ERROR CLASS: Symbol not found for Color, shadow: ERROR CLASS: Symbol not found for Shadow?? = null)

Draws a glyph from the atlas to the canvas. Uses SDF rendering for crisp text at any scale.

actual fun DrawScope.drawGlyph(atlasRect: Rect, destOffset: Offset, destSize: Size, color: Color, shadow: Shadow?)

Draws a glyph from the atlas to the canvas with optional shadow.

Link copied to clipboard
actual fun isReady(): Boolean

Checks if the atlas is ready for rendering.

expect fun isReady(): Boolean

Checks if the atlas is ready for rendering.

actual fun isReady(): Boolean

Checks if the atlas is ready for rendering.

Link copied to clipboard
actual fun loadFallbackFont(fontBytes: ByteArray)

Loads a fallback font. No-op: use NativeTextEngine.loadFallbackFont instead.

expect fun loadFallbackFont(fontBytes: ByteArray)

Loads a fallback font for missing glyphs. Fallback fonts are tried in the order they are loaded.

actual fun loadFallbackFont(fontBytes: ByteArray)

Loads a fallback font. No-op: use NativeTextEngine.loadFallbackFont instead.

Link copied to clipboard
actual fun loadFont(fontBytes: ByteArray)

Loads the primary font. No-op: use NativeTextEngine.loadFont instead.

expect fun loadFont(fontBytes: ByteArray)

Loads the primary font for text rendering.

actual fun loadFont(fontBytes: ByteArray)

Loads the primary font. No-op: use NativeTextEngine.loadFont instead.

Link copied to clipboard
actual fun updateAtlas(uploads: List<GlyphUpload>)

Updates the atlas textures with pending glyph uploads from the native engine.

expect fun updateAtlas(uploads: List<GlyphUpload>)

Updates the atlas texture with pending uploads from the native engine. Call this before drawing if the engine has pending uploads.

actual fun updateAtlas(uploads: List<GlyphUpload>)

Updates the atlas textures with pending glyph uploads from the native engine.