API Documentation
Public Member Functions | List of all members
nkWinUi::ImageManager Class Referencefinal

Manages the images in the component. More...

Inheritance diagram for nkWinUi::ImageManager:

Public Member Functions

SystemgetSystem () const
 
ImagecreateOrRetrieve (nkMemory::StringView name)
 
Imagerecord (nkMemory::StringView name, nkMemory::UniquePtr< Image > resource)
 
Imageget (nkMemory::StringView name) const
 
ImagegetByIndex (unsigned int index) const
 
void rename (nkMemory::StringView oldName, nkMemory::StringView newName)
 
void erase (nkMemory::StringView name)
 
nkMemory::UniquePtr< Imagerelinquish (nkMemory::StringView name)
 

Detailed Description

Manages the images in the component.

Member Function Documentation

◆ getSystem()

System* nkWinUi::ImageManager::getSystem ( ) const
Returns
The system the manager is living in.

◆ createOrRetrieve()

Image* nkWinUi::ImageManager::createOrRetrieve ( nkMemory::StringView  name)

Creates if unavailable, or retrieves if available, an image.

Parameters
nameThe name of the image to retrieve.
Returns
The image requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

◆ record()

Image* nkWinUi::ImageManager::record ( nkMemory::StringView  name,
nkMemory::UniquePtr< Image resource 
)

Records an already existing resource in the manager, passing its ownership around.

Parameters
nameThe name under which the resource should be recorded.
resourceThe resource to record.
Returns
A raw pointer over the resource, now recorded in the manager.

◆ get()

Image* nkWinUi::ImageManager::get ( nkMemory::StringView  name) const

Retrieves an image.

Parameters
nameThe name of the image to retrieve.
Returns
The image requested if available, nullptr else.

◆ getByIndex()

Image* nkWinUi::ImageManager::getByIndex ( unsigned int  index) const

Get an image, by index. Note that one index can map to a different image after memory is changed. Useful to loop over all available images in one go.

Parameters
indexThe index of the image to retrieve.
Returns
The image linked if available, nullptr else.

◆ rename()

void nkWinUi::ImageManager::rename ( nkMemory::StringView  oldName,
nkMemory::StringView  newName 
)

Renames an image.

Parameters
oldNameThe name of the image to rename.
newNameThe name to reassign to the image.

◆ erase()

void nkWinUi::ImageManager::erase ( nkMemory::StringView  name)

Erases and frees an image.

Parameters
nameThe name of the image to erase.

◆ relinquish()

nkMemory::UniquePtr<Image> nkWinUi::ImageManager::relinquish ( nkMemory::StringView  name)

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters
nameThe name of the recorded resource to relinquish.
Returns
The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file: