pub struct BuiltinEditor<P: Params> { /* private fields */ }Expand description
Built-in editor that renders parameter widgets to a pixel buffer.
Uses the CPU backend (tiny-skia) for software rasterization. When
open() is called, creates a platform view and blits pixels at ~60fps.
Implementations§
Source§impl<P: Params + 'static> BuiltinEditor<P>
impl<P: Params + 'static> BuiltinEditor<P>
pub fn new(params: Arc<P>, layout: PluginLayout) -> Self
pub fn new_with_layout(params: Arc<P>, layout: Layout) -> Self
pub fn new_grid(params: Arc<P>, layout: GridLayout) -> Self
pub fn with_theme(self, theme: Theme) -> Self
Sourcepub fn pixel_data(&self) -> Option<&[u8]>
pub fn pixel_data(&self) -> Option<&[u8]>
Get the raw pixel data after rendering (RGBA premultiplied).
Sourcepub fn set_context(&mut self, context: EditorContext)
pub fn set_context(&mut self, context: EditorContext)
Set the editor context (host callbacks) without opening the CPU view.
Sourcepub fn render_to(&mut self, backend: &mut dyn RenderBackend)
pub fn render_to(&mut self, backend: &mut dyn RenderBackend)
Render all widgets to an external RenderBackend.
Used by truce-gpu to draw through the GPU backend instead of
the internal CPU backend.
pub fn on_mouse_down(&mut self, x: f32, y: f32)
pub fn on_mouse_dragged(&mut self, x: f32, y: f32)
pub fn on_mouse_up(&mut self, _x: f32, _y: f32)
pub fn on_double_click(&mut self, x: f32, y: f32)
pub fn on_scroll(&mut self, x: f32, y: f32, delta_y: f32)
pub fn on_mouse_moved(&mut self, x: f32, y: f32) -> bool
Trait Implementations§
Source§impl<P: Params + 'static> Editor for BuiltinEditor<P>
impl<P: Params + 'static> Editor for BuiltinEditor<P>
Source§fn open(&mut self, parent: RawWindowHandle, context: EditorContext)
fn open(&mut self, parent: RawWindowHandle, context: EditorContext)
Create the GUI as a child of the host-provided parent window.
Source§fn set_size(&mut self, _width: u32, _height: u32) -> bool
fn set_size(&mut self, _width: u32, _height: u32) -> bool
Host requests a resize. Return true to accept.
Source§fn can_resize(&self) -> bool
fn can_resize(&self) -> bool
Whether the plugin supports resizing.
Source§fn set_scale_factor(&mut self, _factor: f64)
fn set_scale_factor(&mut self, _factor: f64)
DPI scale factor changed.
impl<P: Params> Send for BuiltinEditor<P>
Auto Trait Implementations§
impl<P> Freeze for BuiltinEditor<P>
impl<P> !RefUnwindSafe for BuiltinEditor<P>
impl<P> !Sync for BuiltinEditor<P>
impl<P> Unpin for BuiltinEditor<P>
impl<P> UnsafeUnpin for BuiltinEditor<P>
impl<P> !UnwindSafe for BuiltinEditor<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more