pub struct PlatformWindow { /* private fields */ }Expand description
A platform window wrapping a winit window, wgpu surface, renderer, and AccessKit adapter for screen reader support.
Implementations§
Source§impl PlatformWindow
impl PlatformWindow
Sourcepub async fn new_with_a11y(window: Window, event_loop: &ActiveEventLoop) -> Self
pub async fn new_with_a11y(window: Window, event_loop: &ActiveEventLoop) -> Self
Create a new platform window from a winit window.
The event_loop parameter is needed for the AccessKit adapter.
Sourcepub async fn new(window: Window) -> Self
pub async fn new(window: Window) -> Self
Create a platform window without AccessKit (for contexts without ActiveEventLoop).
pub fn window(&self) -> &Window
Sourcepub fn window_arc(&self) -> Arc<Window> ⓘ
pub fn window_arc(&self) -> Arc<Window> ⓘ
Get a clonable Arc reference to the underlying winit window.
Used by teksilo_platform::create_title_bar_host and other components
that need shared ownership of the window.
pub fn renderer(&self) -> &Renderer
pub fn renderer_mut(&mut self) -> &mut Renderer
pub fn scale_factor(&self) -> f64
pub fn set_scale_factor(&mut self, factor: f64)
Sourcepub fn resize(&mut self, new_size: PhysicalSize<u32>)
pub fn resize(&mut self, new_size: PhysicalSize<u32>)
Resize the surface.
Sourcepub fn surface_size(&self) -> (u32, u32)
pub fn surface_size(&self) -> (u32, u32)
Get current surface dimensions.
Sourcepub fn reconfigure_surface(&mut self)
pub fn reconfigure_surface(&mut self)
Reconfigure the surface with the current config. Use after a Lost or Outdated surface error.
Sourcepub fn render_frame(
&mut self,
frame: &RenderFrame,
clear_color: [f32; 4],
) -> FrameOutcome
pub fn render_frame( &mut self, frame: &RenderFrame, clear_color: [f32; 4], ) -> FrameOutcome
Render a frame to the surface.
Sourcepub fn capture_offscreen(
&mut self,
frame: &RenderFrame,
clear_color: [f32; 4],
crop: Option<Rect>,
) -> (Vec<u8>, u32, u32)
pub fn capture_offscreen( &mut self, frame: &RenderFrame, clear_color: [f32; 4], crop: Option<Rect>, ) -> (Vec<u8>, u32, u32)
Render frame into an offscreen texture and read it back as
tightly-packed RGBA8 bytes, returning (rgba, width, height).
Used by the debug-only automation bridge to capture a live window
without going through the swapchain — the surface texture is
configured RENDER_ATTACHMENT only (no COPY_SRC), so it can’t be
read back directly. The offscreen texture uses the window’s own
surface format so it matches the renderer’s pipelines; a BGRA
readback is swizzled to RGBA here so the output is always RGBA. With
crop = Some(rect) (physical pixels, clamped to the surface) only
that sub-rectangle is returned. Returns an empty (vec, 0, 0) if
the crop is fully outside the surface.
Note: a native WebView subview composites on top of the wgpu
surface and is invisible to this readback (a transparent hole).
pub fn request_redraw(&self)
Sourcepub fn update_accessibility(&mut self, update: TreeUpdate)
pub fn update_accessibility(&mut self, update: TreeUpdate)
Push an AccessKit TreeUpdate to the adapter (called after layout).
Sourcepub fn process_accessibility_event(&mut self, event: &WindowEvent)
pub fn process_accessibility_event(&mut self, event: &WindowEvent)
Forward a winit WindowEvent to the AccessKit adapter.
Sourcepub fn drain_accessibility_actions(&self) -> Vec<ActionRequest>
pub fn drain_accessibility_actions(&self) -> Vec<ActionRequest>
Drain any pending AccessKit action requests from the adapter.
Auto Trait Implementations§
impl !Freeze for PlatformWindow
impl !RefUnwindSafe for PlatformWindow
impl !Sync for PlatformWindow
impl !UnwindSafe for PlatformWindow
impl Send for PlatformWindow
impl Unpin for PlatformWindow
impl UnsafeUnpin for PlatformWindow
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.