UIImages class

Constructors, destructors, conversion operators

UIImages()
UIImages(const UIImages&) deleted

Public functions

auto operator=(const UIImages&) -> UIImages& deleted
void Initialize(TextureTable& textures)
void Shutdown()
Remove every texture this made. The table's own Shutdown frees them.
void AddRoot(std::string_view directory)
A directory paths are looked up in, after those added before it.
auto Load(std::string_view path) -> GGUI::ImageID
auto Named(std::string_view name) -> GGUI::ImageID
auto Create(uint32_t width, uint32_t height, const void* rgba) -> GGUI::ImageID
An image from pixels: tightly packed RGBA8, sRGB, alpha not multiplied in.
auto AddRegion(GGUI::ImageID image, uint32_t x, uint32_t y, uint32_t width, uint32_t height) -> GGUI::ImageID
A part of image, in its pixels: one icon of an atlas.
auto AddTarget(TextureIndex texture, uint32_t width, uint32_t height) -> GGUI::ImageID
A render target someone else owns and draws into, already in the texture table.
void SetTarget(GGUI::ImageID target, TextureIndex texture, uint32_t width, uint32_t height)
auto WantedSize(GGUI::ImageID target, uint32_t& width, uint32_t& height) const -> bool
void Remove(GGUI::ImageID image)
Stop showing image. A file's texture is released; a target's stays its owner's.
auto Source() const -> const GGUI::ImageSource*
What documents use to describe their images.
void FollowViewports(std::span<const GGUI::ViewportSize> viewports)
Record the viewports' sizes after a document's layout (UIContext::Viewports).
auto Count() const -> uint32_t

Function documentation

GGUI::ImageID UIImages::Load(std::string_view path)

The image at path, loading it the first time. ImageID::None if there is no such file or it could not be read.

GGUI::ImageID UIImages::Named(std::string_view name)

The texture asset named name (as the Content Browser shows it), loading it the first time. ImageID::None, quietly, if there is none: rich text asks for pictures a game may not have drawn (Pad.Xbox.South). Documents asking for a "path" with no folder and no image extension get this.

void UIImages::SetTarget(GGUI::ImageID target, TextureIndex texture, uint32_t width, uint32_t height)

The target was recreated, at another size or in another texture: documents showing it repaint, and lay out again if its size changed.

bool UIImages::WantedSize(GGUI::ImageID target, uint32_t& width, uint32_t& height) const

The size, in pixels, the viewport showing target was given by layout; false if no document lays one out. The target's owner resizes to it.