nano-ui-sdl-0.2.0.0: cbits/nano_ui_text_atlas.h
#ifndef NANO_UI_TEXT_ATLAS_H
#define NANO_UI_TEXT_ATLAS_H
#include <SDL3/SDL.h>
#include <stdbool.h>
#include "nano_ui_ttf_shared.h"
/* Pages the atlas opens before it is out of space: nano-ui-ttf's, which
* nano-ui-sdl-web's atlas uses too. */
#define NANO_UI_TEXT_ATLAS_PAGES NANO_UI_GLYPH_ATLAS_PAGES
typedef struct NanoUiTextAtlas NanoUiTextAtlas;
NanoUiTextAtlas *nano_ui_text_atlas_create(SDL_Renderer *renderer);
void nano_ui_text_atlas_destroy(NanoUiTextAtlas *atlas);
/* The texture of page `page`, or NULL for a page never opened. */
SDL_Texture *nano_ui_text_atlas_texture(NanoUiTextAtlas *atlas, int page);
/* Copy a glyph surface into the atlas, on a new page once the last one is
* full, and write its u0, v0, u1 and v1: normalised to [0,1] within the page,
* plus the page's number in u. False when no page has room or the copy
* fails. */
bool nano_ui_text_atlas_insert_surface(
NanoUiTextAtlas *atlas,
SDL_Surface *surface,
float uv[4]);
void nano_ui_text_atlas_reset(NanoUiTextAtlas *atlas);
/* Destroy every page's texture and empty the atlas, after a render device
* reset emptied the textures; pages are made again as glyphs reach them. */
void nano_ui_text_atlas_drop_textures(NanoUiTextAtlas *atlas);
#endif