Class RenderTarget

Inheritance Relationships

Base Type

  • public Rml::RenderInterface

Class Documentation

class RenderTarget : public Rml::RenderInterface

Declaration: final

RmlUi6.3 CPU geometry/texture bridge on the UI owner.

Handles belong to this recorder; completed recordings own their copies. File images are premultiplied once; generated textures already use premultiplied RGBA. Unsupported effects are reported at recording boundaries without interrupting toolkit cleanup.

Public Functions

explicit RenderTarget(unsigned int maximum_texture_size = 4096)

Require RmlUi6.3 and a positive int-representable texture bound; version mismatch or invalid bound throws.

Session adds the font atlas’s minimum 1024 bound.

void set_view(Rml::Vector2i logical_size)

Copy nonnegative logical dimensions outside an active recording; zero extents produce no visible draws.

void begin_recording()

Clear staged draws and reset scissoring for the configured view.

Reject missing view, an active recording or a latched unsupported feature.

RecordedScene finish_recording()

Declaration: [[nodiscard]]

Transfer complete owned staged draws and stop recording.

Requires an active recording; a latched unsupported feature discards staged work and throws failed_operation.

void discard_recording() noexcept

Discard staged draws and stop recording without clearing a latched unsupported-feature error.

Earlier completed recordings remain independent.

Rml::CompiledGeometryHandle CompileGeometry(Rml::Span<const Rml::Vertex> vertices, Rml::Span<const int> indices) override

Copy/expand indexed triangles and flip texture V into owned colored vertices.

Empty indices return 0. Invalid indices, incomplete triangles, nonfinite coordinates, handle exhaustion and allocation failures throw. Returned handles are local to this RenderTarget until release.

void RenderGeometry(Rml::CompiledGeometryHandle geometry, Rml::Vector2f translation, Rml::TextureHandle texture) override

Append a translated copy of live compiled geometry during recording, with current rectangular clip and retained CPU texture.

Texture 0 means solid. Foreign/released handles or invalid translation reject; empty clip emits nothing. Repeating UVs latch an unsupported-sampler error for publication.

void ReleaseGeometry(Rml::CompiledGeometryHandle geometry) override

Erase a local compiled geometry handle; unknown handles are ignored.

Completed draw copies remain valid.

Rml::TextureHandle LoadTexture(Rml::Vector2i &dimensions, const Rml::String &source) override

Decode an image from a UTF-8 path and premultiply RGB once before retaining CPU pixels.

Set output dimensions on success; decode/unavailable/oversized images return 0 and zero dimensions. Inconsistent metadata or storage/handle failures can throw.

Rml::TextureHandle GenerateTexture(Rml::Span<const Rml::byte> pixels, Rml::Vector2i dimensions) override

Copy already premultiplied RGBA pixels.

Require positive bounded dimensions and exactly width*height*4 bytes; invalid input, exhausted handles or allocation failures throw. Caller storage is not retained.

void ReleaseTexture(Rml::TextureHandle texture) override

Erase local texture ownership; unknown handles are ignored.

Completed draws retain their immutable CPU image.

void EnableScissorRegion(bool enable) override

Select whether subsequent draws use the copied rectangular scissor, intersected with the logical viewport.

void SetScissorRegion(Rml::Rectanglei region) override

Copy ordered logical scissor edges; inverted rectangles reject.

Empty rectangles suppress subsequent clipped draws.

void EnableClipMask(bool enable) override

Disabling is accepted; enabling latches unsupported clip-mask failure for the next recording boundary.

void RenderToClipMask(Rml::ClipMaskOperation, Rml::CompiledGeometryHandle, Rml::Vector2f) override

Latch unsupported clip-mask failure without throwing through the toolkit render-stack cleanup path.

void SetTransform(const Rml::Matrix4f *transform) override

Accept null or identity transforms.

Nonidentity transforms latch an unsupported transform/clipping-contract failure; no native matrix pointer is retained.

Rml::LayerHandle PushLayer() override

Latch unsupported offscreen-layer failure and return 0, permitting toolkit cleanup to finish.

void CompositeLayers(Rml::LayerHandle, Rml::LayerHandle, Rml::BlendMode, Rml::Span<const Rml::CompiledFilterHandle>) override

Latch unsupported offscreen-layer failure; no compositing or borrowed filter retention occurs.

void PopLayer() override

Latch unsupported offscreen-layer failure without throwing during stack cleanup.

Rml::TextureHandle SaveLayerAsTexture() override

Latch unsupported offscreen-texture failure and return 0.

Rml::CompiledFilterHandle SaveLayerAsMaskImage() override

Latch unsupported mask-image failure and return 0.

Rml::CompiledFilterHandle CompileFilter(const Rml::String&, const Rml::Dictionary&) override

Latch unsupported filter failure and return 0; no parameter data is retained.

void ReleaseFilter(Rml::CompiledFilterHandle) override

No-op cleanup for unsupported filters; no filter handles are created by this bridge.

Rml::CompiledShaderHandle CompileShader(const Rml::String&, const Rml::Dictionary&) override

Latch unsupported custom-shader failure and return 0; no shader parameters are retained.

void RenderShader(Rml::CompiledShaderHandle, Rml::CompiledGeometryHandle, Rml::Vector2f, Rml::TextureHandle) override

Latch unsupported custom-shader failure without interrupting toolkit cleanup.

void ReleaseShader(Rml::CompiledShaderHandle) override

No-op cleanup for unsupported shaders; no shader handles are created by this bridge.