A cache of texture data structures that may be shared by other widgets to render textures.
More...
#include <ImageRepository.h>
|
ImageId | getImageId () |
| Get the next available ImageId. More...
|
|
sdl::TextureData & | image (ImageId imageId) |
| Access the TextureData object for an ImageId. More...
|
|
const sdl::TextureData & | image (ImageId imageId) const |
| Const access the TextureData object for an ImageId. More...
|
|
string_view | imageName (ImageId imageId) const |
| Access the name associated with the TextureData object. More...
|
|
string_view | imagePath (ImageId imageId) const |
| Access the file path associated with the TextureData object. More...
|
|
string_view | imageURI (ImageId imageId) const |
| Access the URI associated with the TextureData object. More...
|
|
void | renderCopy (sdl::Renderer &renderer, ImageId imageId, SDL_Rect &imgSrcRect, SDL_Rect &imgPaintRect) |
| Render the texture. More...
|
|
void | renderCopy (sdl::Renderer &renderer, ImageId imageId, SDL_Rect &imgPaintRect) |
| Render the full texture to the destination rectangle. More...
|
|
void | renderCopy (sdl::Renderer &renderer, ImageId imageId, Rectangle &imgSrcRect, Rectangle &imgDstRect) |
| Render the texture. More...
|
|
void | renderCopy (sdl::Renderer &renderer, ImageId imageId, Rectangle &imgDstRect) |
| Render the full source of the texture to the destination. More...
|
|
void | setImage (ImageId imageId, sdl::TextureData textureData) |
| Set an image in the cache replacing any existing image with the provided imageId. More...
|
|
void | setImageSurface (ImageId imageId, sdl::Surface &surface) |
| Set a Surface to be used to create or update the image Texture. More...
|
|
bool | empty () const |
| Determine if the image store is empty. More...
|
|
auto | size () const |
| Determine the size of the image store. More...
|
|
bool | isValidImage (sdl::Renderer &renderer, ImageId imageId) |
| Determine if an image id retrieves an image. More...
|
|
|
static constexpr ImageId | InvalidImageId = 0x0u |
| An invalid image ID which may be used for initialization.
|
|
static constexpr ImageId | FirstApplicationImageId = 0x100u |
| ImageId values [FirstApplicationImageId ... FirstUserImageId) are reserved for Application static images.
|
|
|
static constexpr ImageId | FirstUserImageId = 0x200u |
| This and all following image IDs are available to user applications.
|
|
A cache of texture data structures that may be shared by other widgets to render textures.
◆ empty()
bool rose::ImageRepository::empty |
( |
| ) |
const |
|
inline |
Determine if the image store is empty.
- Returns
- true if empty.
◆ getImageId()
ImageId rose::ImageRepository::getImageId |
( |
| ) |
|
|
inline |
Get the next available ImageId.
- Returns
- the next ImageId.
◆ getSurface()
void rose::ImageRepository::getSurface |
( |
sdl::Renderer & |
renderer, |
|
|
ImageId |
imageId |
|
) |
| |
|
inlineprotected |
Check for a future for an image and get the data if available.
- Parameters
-
renderer | The renderer used to convert the generated surface to a texture. |
imageId | the image identifier |
◆ image() [1/2]
Access the TextureData object for an ImageId.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier |
- Returns
- a reference to the TextureData object.
◆ image() [2/2]
Const access the TextureData object for an ImageId.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier |
- Returns
- a const reference to the TextureData object.
◆ imageName()
string_view rose::ImageRepository::imageName |
( |
ImageId |
imageId | ) |
const |
|
inline |
Access the name associated with the TextureData object.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier. |
- Returns
- a const std::string_view of the image name.
◆ imagePath()
string_view rose::ImageRepository::imagePath |
( |
ImageId |
imageId | ) |
const |
|
inline |
Access the file path associated with the TextureData object.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier. |
- Returns
- a const std::string_view of the image path.
◆ imageURI()
string_view rose::ImageRepository::imageURI |
( |
ImageId |
imageId | ) |
const |
|
inline |
Access the URI associated with the TextureData object.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier. |
- Returns
- a const std::string_view of the image URI.
◆ isValidImage()
bool rose::ImageRepository::isValidImage |
( |
sdl::Renderer & |
renderer, |
|
|
ImageId |
imageId |
|
) |
| |
|
inline |
Determine if an image id retrieves an image.
- Parameters
-
imageId | The ImageId to test. |
- Returns
- true if there is an image for the id.
◆ renderCopy() [1/4]
void rose::ImageRepository::renderCopy |
( |
sdl::Renderer & |
renderer, |
|
|
ImageId |
imageId, |
|
|
SDL_Rect & |
imgSrcRect, |
|
|
SDL_Rect & |
imgPaintRect |
|
) |
| |
|
inline |
Render the texture.
The texture is rendered using the supplied renderer, source and paint rectangles. Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
renderer | the Renderer to use. |
imageId | the image identifier. |
imgSrcRect | the source SDL_Rectangle |
imgPaintRect | the destination SDL_Rectangle |
◆ renderCopy() [2/4]
void rose::ImageRepository::renderCopy |
( |
sdl::Renderer & |
renderer, |
|
|
ImageId |
imageId, |
|
|
SDL_Rect & |
imgPaintRect |
|
) |
| |
|
inline |
Render the full texture to the destination rectangle.
- Parameters
-
renderer | The Renderer to use. |
imageId | The ImageId to render. |
imgPaintRect | The destination rectangle. |
◆ renderCopy() [3/4]
Render the texture.
The texture is rendered using the supplied renderer, source and paint rectangles. Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
◆ renderCopy() [4/4]
Render the full source of the texture to the destination.
- Parameters
-
renderer | The Renderer to use. |
imageId | The ImageId to render. |
imgDstRect | The destination rectangle. |
◆ setImage()
void rose::ImageRepository::setImage |
( |
ImageId |
imageId, |
|
|
sdl::TextureData |
textureData |
|
) |
| |
|
inline |
Set an image in the cache replacing any existing image with the provided imageId.
Throws a std::out_of_range if no such ImageId is in the cache.
- Parameters
-
imageId | the image identifier. |
textureData | the TextureData to store. |
◆ setImageSurface()
void rose::ImageRepository::setImageSurface |
( |
ImageId |
imageId, |
|
|
sdl::Surface & |
surface |
|
) |
| |
|
inline |
Set a Surface to be used to create or update the image Texture.
- Parameters
-
imageId | The ImageId to set or update. |
surface | The Surface. |
◆ size()
auto rose::ImageRepository::size |
( |
| ) |
const |
|
inline |
Determine the size of the image store.
- Returns
- the number of images in the store.
The documentation for this class was generated from the following file: