Resource manager, which handles loading resources from URLs and caching results.
More...
#include "donner/svg/components/resources/ResourceManagerContext.h"
Resource manager, which handles loading resources from URLs and caching results.
◆ addFontFaces()
| void donner::svg::components::ResourceManagerContext::addFontFaces |
( |
std::span< const css::FontFace > | fontFaces | ) |
|
Add a list of css::FontFace objects to be loaded.
- Parameters
-
| fontFaces | Font faces to load. |
◆ getImageSize()
| std::optional< Vector2i > donner::svg::components::ResourceManagerContext::getImageSize |
( |
Entity | entity | ) |
const |
Get the size of an image resource for an entity, if it has one and successfully loaded.
- Parameters
-
| entity | Entity to get the image size for. |
◆ loadExternalSVG()
Load an external SVG document by URL, for use by <use> elements referencing external files.
The document is cached in the \ref SubDocumentCache.
- Parameters
-
| url | URL of the external SVG to load. |
| warningSink | Sink to collect warnings. |
- Returns
- Parsed document handle, or std::nullopt on failure.
◆ loadResources()
| void donner::svg::components::ResourceManagerContext::loadResources |
( |
ParseWarningSink & | warningSink | ) |
|
Load resources such as images.
Note that this doesn't issue network calls directly, but relies on the user's application to handle callbacks for loading URLs and returning their contents.
- Parameters
-
| warningSink | Sink to collect warnings. |
◆ setProcessingMode()
| void donner::svg::components::ResourceManagerContext::setProcessingMode |
( |
ProcessingMode | mode | ) |
|
|
inline |
◆ setResourceLoader()
| void donner::svg::components::ResourceManagerContext::setResourceLoader |
( |
std::unique_ptr< ResourceLoaderInterface > && | loader | ) |
|
|
inline |
Set the user-supplied ResourceLoaderInterface which handles loading URLs and returning their contents.
- Parameters
-
| loader | Resource loader interface, which will be held until overridden. Call this API again with nullptr to unset. |
◆ setSvgParseCallback()
Set the callback used to parse SVG content into sub-documents.
This is called when an <image> element references an SVG file. The callback is injected to avoid circular build dependencies between the component layer and SVGParser.
- Parameters
-
The documentation for this class was generated from the following files: