A rendered image that lives either in a backend GPU texture or in CPU pixels.
More...
#include "donner/svg/renderer/RendererInterface.h"
|
|
| RendererImage ()=default |
| | Constructs an empty image.
|
| | RendererImage (RendererBitmap bitmap) |
| | Constructs a CPU-resident image.
|
| | RendererImage (std::shared_ptr< const RendererTextureSnapshot > texture) |
| | Constructs a GPU-resident image.
|
|
bool | empty () const |
| | Returns true when this image has no content.
|
|
Vector2i | dimensions () const |
| | Pixel dimensions in device pixels, or zero when empty.
|
|
const std::shared_ptr< const RendererTextureSnapshot > & | textureSnapshot () const |
| | The backend texture when this image is GPU-resident, or null when it is CPU pixels.
|
| const RendererBitmap & | bitmap () const |
| | CPU pixels for this image.
|
A rendered image that lives either in a backend GPU texture or in CPU pixels.
Renderers return whichever form the active backend produces natively - a GPU backend hands back a sampleable texture, a software backend hands back pixels - so callers do not have to pick a rendering entry point per backend. A consumer that can sample a texture takes textureSnapshot and uses bitmap only when it is null; a consumer that needs CPU pixels calls bitmap and pays a readback only when the image is GPU-resident.
◆ RendererImage() [1/2]
Constructs a CPU-resident image.
- Parameters
-
| bitmap | Rendered pixels. An empty bitmap yields an empty image. |
◆ RendererImage() [2/2]
Constructs a GPU-resident image.
- Parameters
-
| texture | Backend texture holding the rendered pixels. A null texture yields an empty image. |
◆ bitmap()
CPU pixels for this image.
A GPU-resident image is read back on the first call and the result cached, so a consumer that only ever samples the texture never pays for a readback. The readback may submit GPU work and block for completion.
- Returns
- Rendered pixels, or an empty bitmap when the image is empty or readback is unsupported.
The documentation for this class was generated from the following file: