Class RenderTarget

Inheritance Relationships

Base Type

  • public tgui::BackendRenderTarget

Class Documentation

class RenderTarget : public tgui::BackendRenderTarget

Declaration: final

UI-owner CPU triangle/rectangular-clip recorder.

Configure logical view and pixel rounding before recording; unsupported native clearing rejects.

Public Functions

void setView(tgui::FloatRect view, tgui::FloatRect viewport, tgui::Vector2f targetSize) override

Copy logical view, viewport and target dimensions outside recording.

Require finite nonnegative dimensions and ordered rectangles; invalid/unrepresentable view-to-pixel scale rejects. Zero extents suppress draws.

void set_pixel_scale(tgui::Vector2f scale)

Set positive finite copied framebuffer/logical ratios for toolkit pixel rounding outside recording.

Does not read a window or change logical coordinates.

void begin_recording()

Start a fresh recording with full viewport clipping.

Requires configured view and no active recording; clears previous staged draws.

RecordedScene finish_recording()

Declaration: [[nodiscard]]

Transfer a complete owned recording and stop recording.

Requires active recording and a balanced clip stack; otherwise throws. Copy/retain the result for independent upload.

void discard_recording() noexcept

Discard staged draws and clip layers, restore viewport clip and leave recording inactive.

Completed recordings are unaffected.

void drawGui(const std::shared_ptr<tgui::RootContainer> &root) override

Begin recording and invoke the nonnull native root’s drawing when drawable.

An exception or unbalanced clip stack discards incomplete work and propagates; finish_recording() transfers successful output.

void addClippingLayer(const tgui::RenderStates &states, tgui::FloatRect rect) override

Intersect a validated logical rectangle during recording.

Finite transforms with supported axis-aligned/quarter-turn clipping only; unsupported rotation rejects. Failure preserves the preceding clip stack/region.

void removeClippingLayer() override

Pop a clip layer during recording; missing recording or an empty stack throws failed_operation.

void drawVertexArray(const tgui::RenderStates &states, const tgui::Vertex *vertices, std::size_t vertexCount, const unsigned int *indices, std::size_t indexCount, const std::shared_ptr<tgui::BackendTexture> &texture) override

During recording, expand indexed triangles, or a null-index vertex-order triangle list, into owned colored vertices.

Empty draws are ignored. Require complete triangles, valid bounds/finite positions and a loaded Cheryl texture when textured. Copy input storage before return, flip texture V for atlas orientation and retain CPU pixels/filtering. Invalid input/allocation failure throws; no GPU work occurs.

void setClearColor(const tgui::Color &color) override

Always throw failed_operation: framebuffer clear state belongs to the application/platform renderer, outside CPU toolkit recording.

void clearScreen() override

Always throw failed_operation: the application clears its framebuffer; this bridge only records toolkit draws.