|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
A rendered image that lives either in a backend GPU texture or in CPU pixels. More...
#include "donner/svg/renderer/RendererInterface.h"
Public Member Functions | |
| 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.
|
inlineexplicit |
Constructs a CPU-resident image.
| bitmap | Rendered pixels. An empty bitmap yields an empty image. |
|
inlineexplicit |
Constructs a GPU-resident image.
| texture | Backend texture holding the rendered pixels. A null texture yields an empty image. |
|
inlinenodiscard |
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.