Abstracts an image to be used within the component. More...
Public Member Functions | |
Image () noexcept | |
virtual | ~Image () |
virtual unsigned int | getWidth () const =0 |
virtual unsigned int | getHeight () const =0 |
nkMemory::StringView | getName () const |
bool | getHidden () const |
void | setName (nkMemory::StringView value) |
void | setHidden (bool value) |
void | setFromImage (const nkImages::ImageView &image) |
void | setFromImageCopy (const nkImages::ImageView &image) |
void | setFromImageForward (nkImages::Image &&image) |
virtual bool | load ()=0 |
virtual void | unload ()=0 |
bool | reload () |
Static Public Member Functions | |
static nkMemory::UniquePtr< Image > | create (System *system=nullptr) |
Abstracts an image to be used within the component.
|
noexcept |
Constructor.
|
virtual |
Destructor.
|
pure virtual |
|
pure virtual |
nkMemory::StringView nkWinUi::Image::getName | ( | ) | const |
bool nkWinUi::Image::getHidden | ( | ) | const |
void nkWinUi::Image::setName | ( | nkMemory::StringView | value | ) |
Sets the name of the image to use. Usually used internally through the manager.
value | The name to assign to the image. |
void nkWinUi::Image::setHidden | ( | bool | value | ) |
Sets whether the image is hidden or not. A hidden image will not be discoverable by the getByIndex method of the manager.
value | Whether the image should be hidden (true) or not (false). |
void nkWinUi::Image::setFromImage | ( | const nkImages::ImageView & | image | ) |
Sets the source image to use. This version will only take a view that should remain alive during the entire load process.
image | The image to use as source. |
void nkWinUi::Image::setFromImageCopy | ( | const nkImages::ImageView & | image | ) |
Sets the source image to use. This version will copy the image into an owned memory space.
image | The image to use as source. |
void nkWinUi::Image::setFromImageForward | ( | nkImages::Image && | image | ) |
Sets the source image to use. This version will take ownership of the provided image.
image | The image to use as source. |
|
pure virtual |
Loads the image, creating and filling all the structures it needs to work in the component.
|
pure virtual |
Unloads the image and frees the underlying allocated resources.
bool nkWinUi::Image::reload | ( | ) |
Reloads the resources, automating an unload call followed by a load one.
|
static |
Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.
system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used. |