pub struct Ui<'runtime> { /* private fields */ }Expand description
GPU-retained UI compositor.
Borrows one Runtime for its lifetime; must be closed explicitly before
the runtime or any resource it references is released.
Implementations§
Source§impl<'runtime> Ui<'runtime>
impl<'runtime> Ui<'runtime>
Sourcepub fn init(runtime: &'runtime Runtime, width: u32, height: u32) -> Result<Self>
pub fn init(runtime: &'runtime Runtime, width: u32, height: u32) -> Result<Self>
Initialise the UI layer. Creates pipelines and the compose image.
width and height should match the presentation surface extent.
Sourcepub fn init_with_style(
runtime: &'runtime Runtime,
width: u32,
height: u32,
style: UiStyle,
) -> Result<Self>
pub fn init_with_style( runtime: &'runtime Runtime, width: u32, height: u32, style: UiStyle, ) -> Result<Self>
Initialise with an explicit style theme.
Sourcepub fn resize(&mut self, width: u32, height: u32) -> Result<()>
pub fn resize(&mut self, width: u32, height: u32) -> Result<()>
Recreate the compose image after a surface resize.
Sourcepub fn content_scale(&self) -> f32
pub fn content_scale(&self) -> f32
Logical-to-pixel scale used by donor viewer controls.
Sourcepub fn set_content_scale(&mut self, scale: f32) -> Result<()>
pub fn set_content_scale(&mut self, scale: f32) -> Result<()>
Set the logical-to-framebuffer scale for controls and symbolic icons.
Sourcepub fn set_motion_speed(&mut self, speed: MotionSpeed) -> Result<()>
pub fn set_motion_speed(&mut self, speed: MotionSpeed) -> Result<()>
Select donor widget transition timing without recreating GPU resources.
Sourcepub fn motion_speed(&self) -> MotionSpeed
pub fn motion_speed(&self) -> MotionSpeed
The active widget transition timing; MotionSpeed::Normal when closed.
Sourcepub fn begin_frame(&mut self, delta_ms: f32)
pub fn begin_frame(&mut self, delta_ms: f32)
Begin a new frame. Must be balanced by end_frame.
Sourcepub fn route_event(&mut self, event: &InputEvent) -> bool
pub fn route_event(&mut self, event: &InputEvent) -> bool
Route a platform event. Returns true if a widget consumed it.
Sourcepub fn input(&self) -> &InputState
pub fn input(&self) -> &InputState
Current input snapshot.
Sourcepub fn drag_source(&mut self, id: &str, rect: PixelRect) -> bool
pub fn drag_source(&mut self, id: &str, rect: PixelRect) -> bool
True while the pointer drags a press that began over id’s rect —
movement past the drag threshold with the button still held. Call the
source’s drawing code every frame so hover is registered before the
press frame; while this returns true, Ui::set_drag_payload offers
the payload to targets.
Sourcepub fn set_drag_payload<T: Any>(&mut self, kind: &str, payload: T)
pub fn set_drag_payload<T: Any>(&mut self, kind: &str, payload: T)
Offer payload under kind for the active drag; the last offer in a
frame wins. No-op while no drag_source is active.
Sourcepub fn drag_hovering(&self, rect: PixelRect, kind: &str) -> bool
pub fn drag_hovering(&self, rect: PixelRect, kind: &str) -> bool
True while a kind payload hovers rect — the target-highlight
signal for this frame’s drawing code.
Sourcepub fn drag_drop<T: Any>(&self, rect: PixelRect, kind: &str) -> Option<Rc<T>>
pub fn drag_drop<T: Any>(&self, rect: PixelRect, kind: &str) -> Option<Rc<T>>
On the release frame over rect, return the offered payload when
kind and T match. drag_source no longer reports on this frame —
the payload survives from the last held frame and clears at
end_frame.
Sourcepub fn runtime(&self) -> &'runtime Runtime
pub fn runtime(&self) -> &'runtime Runtime
Borrow the Runtime that owns this UI’s composition resources.
pub fn push_style(&mut self, style: UiStyle)
pub fn pop_style(&mut self)
Sourcepub fn current_style(&self) -> UiStyle
pub fn current_style(&self) -> UiStyle
Return the current ambient widget style.
Donor: oa::Ui::currentStyle.
Sourcepub fn begin_panel(&mut self, _id: &str, rect: PixelRect)
pub fn begin_panel(&mut self, _id: &str, rect: PixelRect)
Begin a new panel scope. Must be balanced by end_panel.
Sourcepub fn begin_panel_with_layout(
&mut self,
_id: &str,
rect: PixelRect,
layout: UiLayout,
)
pub fn begin_panel_with_layout( &mut self, _id: &str, rect: PixelRect, layout: UiLayout, )
Begin a panel with an explicit layout descriptor.
Sourcepub fn end_row(&mut self)
pub fn end_row(&mut self)
End the innermost row scope and advance the parent cursor by row height.
Button. Returns true on click (pointer up inside).
Sourcepub fn checkbox(&mut self, label: &str, value: &mut bool) -> bool
pub fn checkbox(&mut self, label: &str, value: &mut bool) -> bool
Checkbox. Returns true when the value changes.
Sourcepub fn slider_f32(
&mut self,
label: &str,
value: &mut f32,
min: f32,
max: f32,
) -> bool
pub fn slider_f32( &mut self, label: &str, value: &mut f32, min: f32, max: f32, ) -> bool
F32 slider. Returns true when the value changes.
Sourcepub fn progress_bar(&mut self, fraction: f32)
pub fn progress_bar(&mut self, fraction: f32)
Progress bar with a normalized fraction [0, 1].
Sourcepub fn progress_bar_with_overlay(&mut self, fraction: f32, overlay: &str)
pub fn progress_bar_with_overlay(&mut self, fraction: f32, overlay: &str)
Progress bar with an explicit text overlay.
Sourcepub fn label(&mut self, text: &str)
pub fn label(&mut self, text: &str)
Passive text label in the current panel flow.
Does not interact; advances the cursor by one item height.
Donor: oa::Ui::label.
Sourcepub fn slider_i32(
&mut self,
label: &str,
value: &mut i32,
min: i32,
max: i32,
) -> bool
pub fn slider_i32( &mut self, label: &str, value: &mut i32, min: i32, max: i32, ) -> bool
Integer slider. Returns true when the value changes.
Donor: oa::Ui::sliderI32.
Sourcepub fn input_text(&mut self, label: &str, value: &mut String) -> bool
pub fn input_text(&mut self, label: &str, value: &mut String) -> bool
Single-line text input field. Returns true when value changes.
This implementation records the field chrome; keyboard entry is handled
when the field is focused (last clicked). Text is committed on every
character via SDL text-input events routed through route_event.
Donor: oa::Ui::inputText.
Sourcepub fn input_text_multiline(
&mut self,
label: &str,
value: &mut String,
rows: u32,
) -> bool
pub fn input_text_multiline( &mut self, label: &str, value: &mut String, rows: u32, ) -> bool
Multi-line text input — a focusable editable area rows lines tall.
Enter inserts a line break; typed characters append at end-of-text and
backspace removes the last character, matching input_text’s editing
model (no mid-text caret). Lines past rows clip at the field edge.
Returns true when value changed.
Sourcepub fn color_swatch(&mut self, color: Color, size: [f32; 2])
pub fn color_swatch(&mut self, color: Color, size: [f32; 2])
Color swatch — a filled rectangle of the given color at the given size.
Placed inline in the current panel flow. Does not return a value.
Donor: oa::Ui::colorSwatch.
Sourcepub fn color_picker(&mut self, label: &str, value: &mut Color) -> bool
pub fn color_picker(&mut self, label: &str, value: &mut Color) -> bool
Color picker — a labeled button with the current color swatch that
opens a popup holding four RGBA channel sliders and a live preview.
Returns true while value is being dragged to a new color.
Sourcepub fn tab_bar(
&mut self,
_id: &str,
rect: PixelRect,
items: &[UiTabItem],
state_out: &mut UiTabBarState,
) -> UiTabBarResult
pub fn tab_bar( &mut self, _id: &str, rect: PixelRect, items: &[UiTabItem], state_out: &mut UiTabBarState, ) -> UiTabBarResult
Tab bar widget. Returns interaction results; mutates state.selected.
Donor: oa::Ui::tabBar.
Sourcepub fn tree_row(
&mut self,
id: &str,
rect: PixelRect,
label: &str,
config: UiTreeRowConfig,
) -> UiTreeRowResult
pub fn tree_row( &mut self, id: &str, rect: PixelRect, label: &str, config: UiTreeRowConfig, ) -> UiTreeRowResult
Tree row — one row in a hierarchical list.
Donor: oa::Ui::treeRow.
Sourcepub fn node_canvas_grid(&mut self, canvas: &NodeCanvas, rect: PixelRect)
pub fn node_canvas_grid(&mut self, canvas: &NodeCanvas, rect: PixelRect)
Node-graph canvas background grid.
Renders a multi-level dot/line grid in rect, respecting the canvas
pan/zoom from canvas. Does not participate in panel flow (explicit
rect).
Donor: oa::Ui::nodeCanvasGrid.
Sourcepub fn plot_line_bindless(
&mut self,
values_idx: u32,
count: u32,
y_min: f32,
y_max: f32,
color: Color,
)
pub fn plot_line_bindless( &mut self, values_idx: u32, count: u32, y_min: f32, y_max: f32, color: Color, )
Single-series GPU line plot of a CPU F32 slice.
The data must already be uploaded into the bindless heap as a storage buffer. Callers uploading host data should use the runtime’s buffer upload path and pass the resulting bindless index.
Sourcepub fn plot_line_at(
&mut self,
values: &[f32],
rect: PixelRect,
y_min: f32,
y_max: f32,
color: Color,
line_width: f32,
) -> Result<()>
pub fn plot_line_at( &mut self, values: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
Draw one F32 line series into an explicit pixel rectangle.
The samples are uploaded through this UI’s Runtime and retained until the exact composition submission completes; callers never handle descriptor indices or Vulkan objects.
Sourcepub fn plot_band_at(
&mut self,
y_lo: &[f32],
y_hi: &[f32],
rect: PixelRect,
y_min: f32,
y_max: f32,
color: Color,
) -> Result<()>
pub fn plot_band_at( &mut self, y_lo: &[f32], y_hi: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, ) -> Result<()>
Fill the band between two equal-length F32 curves into rect.
The samples occupy uniform x positions 0..n-1 and upload as two
consecutive blocks consumed by the band path of the plot-line shader;
a NaN on either boundary drops that column. color supplies the
band tint including alpha.
Sourcepub fn plot_line(
&mut self,
values: &[f32],
rect: PixelRect,
config: &UiPlotConfig,
) -> Result<()>
pub fn plot_line( &mut self, values: &[f32], rect: PixelRect, config: &UiPlotConfig, ) -> Result<()>
Draw one F32 line series with the donor chart widget contract.
Donor: oa::Ui::plotLine. Y bounds come from config or resolve from
finite samples when auto_scale is set; a degenerate resolved range is
expanded by a small margin. show_grid/draw_surface paint the chart
grid first; fill shades under the series. The samples are uploaded
through this UI’s Runtime and retained until the exact composition
submission completes.
A series whose auto-scaled range contains no finite sample draws nothing, matching the donor’s silent skip.
Sourcepub fn line_at(
&mut self,
from: [f32; 2],
to: [f32; 2],
color: Color,
thickness: f32,
bounds: PixelRect,
) -> Result<()>
pub fn line_at( &mut self, from: [f32; 2], to: [f32; 2], color: Color, thickness: f32, bounds: PixelRect, ) -> Result<()>
Draw an anti-aliased screen-space line.
Sourcepub fn image_at(&mut self, texture: &Texture, rect: PixelRect) -> Result<()>
pub fn image_at(&mut self, texture: &Texture, rect: PixelRect) -> Result<()>
Blit one packed buffer-backed RGBA8 Texture into the compose image.
Sourcepub fn text_at(
&mut self,
text: &str,
origin: [f32; 2],
config: TextLayoutConfig,
color: Color,
clip: PixelRect,
) -> Result<()>
pub fn text_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
Shape and draw text at a pixel-space baseline origin.
Sourcepub fn text_vertical_at(
&mut self,
text: &str,
origin: [f32; 2],
config: TextLayoutConfig,
color: Color,
clip: PixelRect,
) -> Result<()>
pub fn text_vertical_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
Shape and draw bottom-to-top text — the matplotlib y-label orientation.
origin is the baseline point in compose pixels: the baseline runs
vertically at origin[0] and the pen advances upward from origin[1].
Each record sets the donor rotation flag (flags bit 0), which swaps
the quad extents and rotates coverage sampling 90° counter-clockwise.
Sourcepub fn rect_raw(
&mut self,
rect: PixelRect,
color: Color,
clip: PixelRect,
corner_radius: f32,
)
pub fn rect_raw( &mut self, rect: PixelRect, color: Color, clip: PixelRect, corner_radius: f32, )
Alpha-blend a filled rect at an explicit position.
Sourcepub fn rect_outline_raw(
&mut self,
rect: PixelRect,
color: Color,
thickness: u32,
clip: PixelRect,
)
pub fn rect_outline_raw( &mut self, rect: PixelRect, color: Color, thickness: u32, clip: PixelRect, )
Alpha-blend a rect outline at an explicit position.
Sourcepub fn rect_outline_rounded_at(
&mut self,
rect: PixelRect,
color: Color,
thickness: u32,
clip: PixelRect,
radius: f32,
)
pub fn rect_outline_rounded_at( &mut self, rect: PixelRect, color: Color, thickness: u32, clip: PixelRect, radius: f32, )
Draw a rounded outline using the retained compositor.
Sourcepub fn rect(
&mut self,
rect: PixelRect,
color: Color,
corner_radius: f32,
) -> Result<()>
pub fn rect( &mut self, rect: PixelRect, color: Color, corner_radius: f32, ) -> Result<()>
Alpha-blend a filled rect clipped to the current panel scope.
Donor: oa::Ui::rect. Nonpositive or out-of-scope rects draw nothing.
corner_radius must be finite and non-negative; it is clamped to half
the smaller side exactly like the donor.
Sourcepub fn rect_outline(
&mut self,
rect: PixelRect,
color: Color,
thickness: u32,
corner_radius: f32,
) -> Result<()>
pub fn rect_outline( &mut self, rect: PixelRect, color: Color, thickness: u32, corner_radius: f32, ) -> Result<()>
Alpha-blend a rect outline clipped to the current panel scope.
Donor: oa::Ui::rectOutline.
Sourcepub fn rect_outlines(
&mut self,
detections: &DetectionBuffer,
dst: PixelRect,
clip: PixelRect,
color: Color,
thickness: u32,
) -> Result<()>
pub fn rect_outlines( &mut self, detections: &DetectionBuffer, dst: PixelRect, clip: PixelRect, color: Color, thickness: u32, ) -> Result<()>
Draw normalized rectangle records from a GPU detection buffer in one dispatch.
dst maps the records’ normalized source-image coordinates into the
compose image; clip bounds rasterization and is intersected with
dst. Records carry an optional per-instance 0xRRGGBBAA color that
falls back to color. Donor: oa::Ui::rectOutlines.
Sourcepub fn glyphs(
&mut self,
buffer: &GlyphBuffer,
dst: PixelRect,
clip: PixelRect,
) -> Result<()>
pub fn glyphs( &mut self, buffer: &GlyphBuffer, dst: PixelRect, clip: PixelRect, ) -> Result<()>
Draw a source-anchored glyph batch from one GPU record buffer through
this Ui’s coverage atlas.
dst maps the records’ normalized source-image anchors into the
compose image while offsets and glyph extents stay in pixels; clip
bounds rasterization and is intersected with dst. Donor:
oa::Ui::glyphs.
Sourcepub fn text_atlas(&self) -> Result<&TextAtlas>
pub fn text_atlas(&self) -> Result<&TextAtlas>
Return this Ui’s shared coverage atlas for shaping record buffers.
Glyph records store atlas coordinates; this atlas is the only producer
of those coordinates, so Ui::glyphs consumers shape against the
same instance their rasterization samples.
§Errors
Returns an error when the Ui is closed.
Sourcepub fn timeline(
&mut self,
id: &str,
rect: PixelRect,
fraction: &mut f32,
out_active: Option<&mut bool>,
) -> bool
pub fn timeline( &mut self, id: &str, rect: PixelRect, fraction: &mut f32, out_active: Option<&mut bool>, ) -> bool
Playback timeline scrub bar. Returns true while scrubbing.
fraction is clamped to [0, 1]. out_active is set to true while
the pointer is held down on the bar.
Donor: oa::Ui::timeline.
Sourcepub fn waveform_timeline(
&mut self,
id: &str,
rect: PixelRect,
envelope: &[f32],
fraction: &mut f32,
) -> bool
pub fn waveform_timeline( &mut self, id: &str, rect: PixelRect, envelope: &[f32], fraction: &mut f32, ) -> bool
Waveform timeline — like timeline but draws the waveform envelope
behind the scrub bar.
envelope must be a 1-D slice of pre-computed RMS/peak amplitudes in
[0, 1]. One value per horizontal pixel is ideal; fewer values are
stretched.
Donor: oa::Ui::waveformTimeline.
Sourcepub fn begin_scroll_panel(
&mut self,
id: &str,
rect: PixelRect,
content_height: i32,
config: UiScrollConfig,
) -> UiScrollRegion
pub fn begin_scroll_panel( &mut self, id: &str, rect: PixelRect, content_height: i32, config: UiScrollConfig, ) -> UiScrollRegion
Scrollable panel. Returns scroll region info.
content_height is the total height of the content in pixels.
Caller provides the panel id for scroll-offset persistence.
Donor: oa::Ui::beginScrollPanel / endScrollPanel.
Sourcepub fn end_scroll_panel(&mut self)
pub fn end_scroll_panel(&mut self)
End the innermost scroll panel.
Donor: oa::Ui::endScrollPanel.
Sourcepub fn virtual_rows(
&mut self,
item_count: i32,
row_height: i32,
row_gap: i32,
overscan_rows: i32,
) -> UiVirtualRange
pub fn virtual_rows( &mut self, item_count: i32, row_height: i32, row_gap: i32, overscan_rows: i32, ) -> UiVirtualRange
Virtual row helper — returns the range of row indices that are visible inside the current scroll panel’s viewport.
Donor: oa::Ui::virtualRows.
Sourcepub fn split_pane(
&mut self,
id: &str,
rect: PixelRect,
ratio: &mut f32,
config: UiSplitConfig,
) -> UiSplitRegion
pub fn split_pane( &mut self, id: &str, rect: PixelRect, ratio: &mut f32, config: UiSplitConfig, ) -> UiSplitRegion
Two-pane split view. Mutates ratio (first pane fraction in [0, 1]).
Donor: oa::Ui::splitPane.
Sourcepub fn property_row(
&mut self,
_id: &str,
rect: PixelRect,
label: &str,
value: &str,
config: UiPropertyRowConfig,
) -> UiPropertyRegion
pub fn property_row( &mut self, _id: &str, rect: PixelRect, label: &str, value: &str, config: UiPropertyRowConfig, ) -> UiPropertyRegion
Property row — a two-column row with a label and a value area.
Donor: oa::Ui::propertyRow.
Sourcepub fn open_popup(&mut self, id: &str)
pub fn open_popup(&mut self, id: &str)
Register a popup to open at the current pointer position.
Donor: oa::Ui::openPopup.
Sourcepub fn open_popup_at(&mut self, id: &str, anchor: PixelRect)
pub fn open_popup_at(&mut self, id: &str, anchor: PixelRect)
Register a popup to open anchored to anchor.
Donor: oa::Ui::openPopup(id, anchor).
Sourcepub fn close_popup(&mut self)
pub fn close_popup(&mut self)
Close the currently open popup.
Donor: oa::Ui::closePopup.
Sourcepub fn is_popup_open(&mut self, id: &str) -> bool
pub fn is_popup_open(&mut self, id: &str) -> bool
True when the popup with id is currently open.
Donor: oa::Ui::isPopupOpen.
Sourcepub fn begin_popup(&mut self, id: &str, config: UiPopupConfig) -> bool
pub fn begin_popup(&mut self, id: &str, config: UiPopupConfig) -> bool
Begin a popup panel. Returns true if the popup is open and was laid
out; the caller must call end_popup if and only if begin_popup
returned true.
Donor: oa::Ui::beginPopup.
Menu item inside an open popup. Returns true when clicked.
Donor: oa::Ui::menuItem.
Menu entry — a labelled button that opens a popup of menu_items
anchored below it. Returns true while the menu is open; emit items
then call Ui::end_menu. Click/activate toggles the popup; the
popup closes on outside press or when an item activates.
Donor: oa::Ui::menu / beginMenu.
End a menu opened by Ui::menu.
Sourcepub fn dropdown(
&mut self,
label: &str,
items: &[&str],
selected: &mut i32,
_config: UiDropdownConfig,
) -> bool
pub fn dropdown( &mut self, label: &str, items: &[&str], selected: &mut i32, _config: UiDropdownConfig, ) -> bool
Dropdown selection widget. Returns true when selected changes.
items is the list of option strings. selected is the current index
(may be -1 for no selection).
Donor: oa::Ui::dropdown.
Sourcepub fn combo(
&mut self,
label: &str,
items: &[&str],
selected: &mut i32,
filter: &mut String,
) -> bool
pub fn combo( &mut self, label: &str, items: &[&str], selected: &mut i32, filter: &mut String, ) -> bool
Filterable combo box — a dropdown whose open state turns the button
into a text filter. Items matching filter (case-insensitive
substring) stay selectable in the popup; typing while the combo is
open narrows the list. On selection filter is set to the item text.
Returns true when selected changed this frame.
Sourcepub fn table(
&mut self,
id: &str,
columns: &[&str],
rows: &[&[&str]],
widths: &[f32],
state: &mut UiTableState,
config: UiTableConfig,
) -> bool
pub fn table( &mut self, id: &str, columns: &[&str], rows: &[&[&str]], widths: &[f32], state: &mut UiTableState, config: UiTableConfig, ) -> bool
Data table — a header band plus selectable text rows in one widget
rect. Column widths are normalized ratios; an empty slice splits
the width evenly. Selection is caller-owned via state.selected
(-1 = none); returns true when it changed this frame.
Rows beyond config.max_visible_rows are not drawn — windowing is
the consumer’s job (pair with virtual_rows for large data).
Sourcepub fn tooltip(&mut self, text: &str, _config: UiTooltipConfig)
pub fn tooltip(&mut self, text: &str, _config: UiTooltipConfig)
Tooltip shown near the current pointer when the previous widget is hovered. Caller should call this immediately after the widget it annotates; it is a no-op when nothing is hovered.
Donor: oa::Ui::tooltip.
Sourcepub fn heatmap_inline(
&mut self,
_label: &str,
data: &[f32],
config: UiHeatmapConfig,
) -> Result<()>
pub fn heatmap_inline( &mut self, _label: &str, data: &[f32], config: UiHeatmapConfig, ) -> Result<()>
Inline heatmap widget placed in the current panel flow.
Each element in data maps to one cell. Values are scaled from
[v_min, v_max] to a color in the chosen colormap.
Donor: oa::Ui::heatmap.
Sourcepub fn text(&mut self, content: &str)
pub fn text(&mut self, content: &str)
Flow text widget (multi-word content, regular weight).
Equivalent to label but uses regular Sans weight for body text.
Donor: oa::Ui::text.
Sourcepub fn label_fmt(&mut self, text: &str)
pub fn label_fmt(&mut self, text: &str)
Formatted label (printf-style convenience wrapper around label).
Donor: oa::Ui::labelFmt.
Donor geometric icon button with circular hover fill and cubic transitions.
Icons use GPU lines, outlines and filled triangles, never Unicode substitutes.
Donor: oa::Ui::iconButton.
Sourcepub fn heatmap_matrix_at(
&mut self,
values: &Matrix,
rect: PixelRect,
range: [f32; 2],
colormap: u32,
show_grid: bool,
) -> Result<()>
pub fn heatmap_matrix_at( &mut self, values: &Matrix, rect: PixelRect, range: [f32; 2], colormap: u32, show_grid: bool, ) -> Result<()>
Render a dense FP32 matrix directly on the GPU, retaining its storage. Donor: Ui::heatmap/drawHeatmap.slang. Explicit limits avoid host auto-scaling.
Sourcepub fn waveform_matrix_at(
&mut self,
values: &Matrix,
rect: PixelRect,
fraction: f32,
played: Color,
remaining: Color,
) -> Result<()>
pub fn waveform_matrix_at( &mut self, values: &Matrix, rect: PixelRect, fraction: f32, played: Color, remaining: Color, ) -> Result<()>
Render a retained [bins, 2] min/max envelope without readback.
Donor: Ui::waveformTimeline/drawWaveform.slang; fraction marks playback.
Sourcepub fn waveform_matrix_timeline(
&mut self,
id: &str,
rect: PixelRect,
values: &Matrix,
fraction: &mut f32,
) -> Result<bool>
pub fn waveform_matrix_timeline( &mut self, id: &str, rect: PixelRect, values: &Matrix, fraction: &mut f32, ) -> Result<bool>
GPU envelope scrubber with the donor min/max bars and playhead.
Donor: oa::Ui::waveformTimeline; source storage is retained until completion.
Sourcepub fn mask_rounded_rect(
&mut self,
rect: PixelRect,
radius: f32,
outside: Color,
) -> Result<()>
pub fn mask_rounded_rect( &mut self, rect: PixelRect, radius: f32, outside: Color, ) -> Result<()>
Apply the donor premultiplied rounded mask after drawing a viewport.
Chevron (prev/next) button. Returns true on click.
Donor: oa::Ui::chevronButton.
Text button with explicit rect and text config.
Donor: oa::Ui::textButton.
Sourcepub fn grid(&mut self, rect: PixelRect, config: UiGridConfig)
pub fn grid(&mut self, rect: PixelRect, config: UiGridConfig)
Draw the donor decimal grid and gradient in one GPU dispatch.
Invalid geometry/configuration is reported by the next render boundary,
matching other infallible widget APIs. Donor: oa::Ui::grid.
Sourcepub fn image_planar(
&mut self,
planes: &ImagePlanes,
dst_x: i32,
dst_y: i32,
) -> Result<()>
pub fn image_planar( &mut self, planes: &ImagePlanes, dst_x: i32, dst_y: i32, ) -> Result<()>
Composite all channels of a planar multi-dtype image into one image.
Inside a panel the image scales to the panel rectangle; otherwise it
draws at native size at (dst_x, dst_y). Plane buffers stay retained
until the frame completes.
Donor: oa::Ui::imagePlanar.
Sourcepub fn image_plane(
&mut self,
planes: &ImagePlanes,
channel: usize,
dst_x: i32,
dst_y: i32,
) -> Result<()>
pub fn image_plane( &mut self, planes: &ImagePlanes, channel: usize, dst_x: i32, dst_y: i32, ) -> Result<()>
Blit one channel of a planar image as grayscale.
Donor: oa::Ui::imagePlane.
Sourcepub fn plot_line_xy_at(
&mut self,
x: &[f32],
y: &[f32],
rect: PixelRect,
y_min: f32,
y_max: f32,
color: Color,
line_width: f32,
) -> Result<()>
pub fn plot_line_xy_at( &mut self, x: &[f32], y: &[f32], rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
Draw an explicit X/Y line series into an explicit pixel rectangle.
x and y must have the same length.
Donor: oa::Ui::plotLineXY.
Sourcepub fn plot_xy_at(
&mut self,
x: &[f32],
y: &[f32],
rect: PixelRect,
x_min: f32,
x_max: f32,
y_min: f32,
y_max: f32,
color: Color,
antialias_samples: u32,
line_width: f32,
) -> Result<()>
pub fn plot_xy_at( &mut self, x: &[f32], y: &[f32], rect: PixelRect, x_min: f32, x_max: f32, y_min: f32, y_max: f32, color: Color, antialias_samples: u32, line_width: f32, ) -> Result<()>
Draw an explicit X/Y line series into rect with declared data limits.
The samples are packed as one contiguous X block followed by the Y
block — the draw_plot_line explicit-XY ABI — and uploaded through
this UI’s Runtime with retention until the composition submission
completes. Values outside the declared limits clamp to the rectangle
edge; non-finite points break the polyline.
Sourcepub fn plot_xy_matrix_at(
&mut self,
values: &Matrix,
rect: PixelRect,
x_min: f32,
x_max: f32,
y_min: f32,
y_max: f32,
color: Color,
antialias_samples: u32,
line_width: f32,
) -> Result<()>
pub fn plot_xy_matrix_at( &mut self, values: &Matrix, rect: PixelRect, x_min: f32, x_max: f32, y_min: f32, y_max: f32, color: Color, antialias_samples: u32, line_width: f32, ) -> Result<()>
Draw a device-resident explicit-XY line series.
values must be an F32 rank-2 [2, N] Matrix whose contiguous
storage holds one X block followed by one Y block — the exact layout
plot_xy_at uploads — so the same draw_plot_line dispatch applies
without an extra copy. The matrix is retained until the composition
completes.
Sourcepub fn plot_line_matrix_at(
&mut self,
values: &Matrix,
rect: PixelRect,
y_min: f32,
y_max: f32,
color: Color,
line_width: f32,
) -> Result<()>
pub fn plot_line_matrix_at( &mut self, values: &Matrix, rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
Draw a device-resident y-vs-index line series.
values must be an F32 rank-1 [N] Matrix; samples map evenly
across rect exactly as plot_line_at does for uploaded data. The
matrix is retained until the composition completes.
Sourcepub fn plot_line_ring_at(
&mut self,
data: &[f32],
offset: usize,
rect: PixelRect,
y_min: f32,
y_max: f32,
color: Color,
line_width: f32,
) -> Result<()>
pub fn plot_line_ring_at( &mut self, data: &[f32], offset: usize, rect: PixelRect, y_min: f32, y_max: f32, color: Color, line_width: f32, ) -> Result<()>
Draw a ring-buffer line series (circular / most-recent-N view).
offset is the index of the oldest sample in data.
Donor: oa::Ui::plotLineRing.
Sourcepub fn accessibility_snapshot(&self) -> UiAccessibilitySnapshot
pub fn accessibility_snapshot(&self) -> UiAccessibilitySnapshot
Returns a lightweight snapshot of the current widget tree for accessibility tooling.
This implementation returns the node count only; full AT-SPI integration remains Planned.
Donor: oa::Ui::accessibilitySnapshot.
Sourcepub fn wants_text_input(&self) -> bool
pub fn wants_text_input(&self) -> bool
Returns true when a text input widget currently has focus and the
platform IME should be enabled.
Donor: oa::Ui::wantsTextInput.
Sourcepub fn text_input_rect(&self) -> Option<PixelRect>
pub fn text_input_rect(&self) -> Option<PixelRect>
Returns the pixel rect of the focused text input widget, if any.
Returns None when no text field is focused.
Set by input_text / input_text_multiline each frame; the window
owner drives SDL_SetTextInputArea from it to anchor the platform’s
IME candidate window.
Donor: oa::Ui::textInputRect.
Sourcepub fn glyphs_at(
&mut self,
text: &str,
origin: [f32; 2],
config: TextLayoutConfig,
color: Color,
clip: PixelRect,
) -> Result<()>
pub fn glyphs_at( &mut self, text: &str, origin: [f32; 2], config: TextLayoutConfig, color: Color, clip: PixelRect, ) -> Result<()>
Emit positioned glyph quads from a pre-shaped buffer.
glyphs is a slice of (x, y, codepoint, color_rgba) values built by
the caller using the text shaping API. This is the low-level path used
by custom text renderers.
Donor: oa::Ui::glyphs.
Sourcepub fn render_rgba8(&mut self) -> Result<Vec<u8>>
pub fn render_rgba8(&mut self) -> Result<Vec<u8>>
Compose the current command list on the GPU and return exact packed RGBA8.
This is an explicit blocking host-observation boundary intended for headless image/file sinks and test oracles.
Sourcepub fn compose_extent(&self) -> Option<[u32; 2]>
pub fn compose_extent(&self) -> Option<[u32; 2]>
Return the compose image extent.
Sourcepub fn present_to(&mut self, presenter: &mut Presenter<'_>) -> Result<bool>
pub fn present_to(&mut self, presenter: &mut Presenter<'_>) -> Result<bool>
Compose the current command list and blit directly to presenter’s
swapchain — no host readback.
Call pattern: build frame inside begin_frame / end_frame, then call
this instead of render_rgba8. The compose image size drives the
source; the swapchain blit scales to the drawable extent automatically.