TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Paper/llms.txt
Use this file to discover all available pages before exploring further.
Paper class is the root object for every Prowl.Paper UI session. You create one instance per viewport, feed it a renderer and dimensions, then call BeginFrame and EndFrame around your immediate-mode draw code each tick. Everything else — elements, animations, input, styles — hangs off this single object.
Constructor
The backend canvas renderer that Paper will issue draw calls to. Implement
ICanvasRenderer in your host project to bridge Paper to any graphics API.Initial viewport width in logical (CSS-style) pixels.
Initial viewport height in logical pixels.
Settings used by the internal
Canvas to rasterize font glyphs. Includes atlas size and default font.Frame Loop
Every frame you must bracket your UI code withBeginFrame and EndFrame. Input feed calls go before BeginFrame; element and style calls go between the two.
Build UI
Call
Box, Row, Column, animation helpers, style setters, and anything else that describes your layout.BeginFrame
Elapsed seconds since the previous frame. Used to advance
Time, DeltaTime, and all animation state.When greater than
0, sets DisplayFramebufferScale to (dpiScale, dpiScale) for this frame. Pass 0 or a negative value to leave DisplayFramebufferScale untouched (useful if you set it manually before the call).EndFrame
- Updates all element style transitions.
- Fires
OnEndOfFramePreLayout, then runs the layout pass. - Fires
OnEndOfFramePostLayout. - Calls post-layout callbacks recursively.
- Performs hit-testing and interaction handling.
- Renders the element tree (respecting layer ordering).
- Calls
Canvas.Render()and closes the input frame. - Cleans up stale element storage and style entries.
- Records
MillisecondsSpent.
Core Properties
Viewport width in logical units, derived from the canvas or the last value passed to
SetResolution.Viewport height in logical units.
Convenience rectangle
Rect(0, 0, Width, Height) covering the full viewport.Physical-pixels-per-logical-pixel ratio for the main viewport. Default is
(1, 1). Set to (2, 2) on Retina/HiDPI displays so Paper rasterizes fonts and scales vertex output at the correct density. Must be set before BeginFrame.Shorthand for
DisplayFramebufferScale.X.Accumulated multiplier applied by all previous calls to
ScaleAllSizes. Starts at 1.0.Handle to the invisible root element that owns the entire element hierarchy. Recreated each
BeginFrame.The underlying
Prowl.Quill.Canvas used for all draw calls. Available for advanced direct rendering within Draw callbacks.The renderer supplied to the constructor.
Wall-clock milliseconds consumed by the last
EndFrame call. Useful for performance profiling.Number of distinct elements created during the last frame (after duplicates are detected and before any are removed).
The element at the top of the internal element stack — i.e., the element whose scope is currently open. All new elements created via
Box, Row, Column, etc. are added as children of CurrentParent.Resolution
SetResolution
BeginFrame, which passes the new dimensions to the canvas and uses them when constructing the root element.
New logical viewport width.
New logical viewport height.
ScaleAllSizes
scaleFactor. Call once at startup — typically with the monitor DPI ratio — to adapt default style values to HiDPI displays.
Must be greater than
0. Values less than 1 shrink defaults; values greater than 1 grow them.Font Utilities
AddFallbackFont
FontFile with the canvas. When a glyph is missing from the primary font, Paper tries each fallback in registration order.
A loaded font file to use as a fallback.
EnumerateSystemFonts
Lazy enumeration of all font files discovered on the host system by the underlying canvas.
MeasureText (overload 1)
text without creating a full TextLayout.
The string to measure.
Font size in pixels.
The font to use for measurement.
Extra spacing between characters in pixels.
Width and height of the measured text in logical pixels.
MeasureText (overload 2)
The string to measure.
Full layout settings including font, size, wrapping, and alignment.
Width and height of the measured text.
CreateLayout
TextLayout object suitable for repeated rendering without re-shaping on every frame.
The string to lay out.
Layout settings.
A pre-shaped text layout that can be passed to canvas draw calls.
Frame Events
TwoAction delegates fire at specific points inside EndFrame, giving you hooks to inject logic at layout boundaries without subclassing Paper.
Invoked after style updates but before the layout pass runs. Use this to modify element properties or add elements that depend on computed style but not yet computed positions.
Invoked immediately after the layout pass completes, before rendering. Computed
X, Y, LayoutWidth, and LayoutHeight values on all elements are stable here.