pub struct WebCanvasApp {
pub engine: VeloxEngine,
/* private fields */
}Expand description
面向自适应网页窗口的动态分辨率 WebAssembly <canvas> 应用实例。
Fields§
§engine: VeloxEngineImplementations§
Source§impl WebCanvasApp
impl WebCanvasApp
Sourcepub fn set_dpi_scale(&mut self, scale: i16)
pub fn set_dpi_scale(&mut self, scale: i16)
设置物理像素 HiDPI 缩放倍率(如 Retina 2x / 3x),布局与点击事件保持逻辑坐标 (width, height)。
Sourcepub fn resize(&mut self, width: i16, height: i16)
pub fn resize(&mut self, width: i16, height: i16)
响应浏览器 ResizeObserver 或 window.onresize 动态调整画布分辨率。
Sourcepub fn set_safe_area(&mut self, top: i16, right: i16, bottom: i16, left: i16)
pub fn set_safe_area(&mut self, top: i16, right: i16, bottom: i16, left: i16)
同步浏览器 env(safe-area-inset-*) 安全区边距。
Sourcepub fn set_async_waker(&mut self, waker: impl Fn() + Send + Sync + 'static)
pub fn set_async_waker(&mut self, waker: impl Fn() + Send + Sync + 'static)
注入 Web 宿主唤醒回调(例如 queueMicrotask / requestAnimationFrame 触发器)。
Sourcepub fn poll_async_tasks(&mut self) -> bool
pub fn poll_async_tasks(&mut self) -> bool
排空浏览器主线程中所有已就绪的前景异步协程与 defer 回调。
Sourcepub fn needs_redraw(&self) -> bool
pub fn needs_redraw(&self) -> bool
是否存在待重绘脏视图、动画或已就绪异步任务(用于决定浏览器是否按需暂停 requestAnimationFrame)。
Sourcepub fn step_frame(&mut self, dt_ms: u16) -> usize
pub fn step_frame(&mut self, dt_ms: u16) -> usize
推进一帧渲染并光栅化所有脏矩形,返回本帧脏矩形个数。
Sourcepub fn rgba_bytes(&self) -> &[u8] ⓘ
pub fn rgba_bytes(&self) -> &[u8] ⓘ
获取供浏览器 ImageData 零拷贝读取的 RGBA8888 字节切片。
Sourcepub fn dirty_rects(&self) -> &[CDirtyRect]
pub fn dirty_rects(&self) -> &[CDirtyRect]
获取本帧脏矩形切片。
Sourcepub fn cursor_shape(&self) -> CursorShape
pub fn cursor_shape(&self) -> CursorShape
获取当前指针下方组件要求的鼠标光标形状(供 <canvas> 实时同步 canvas.style.cursor)。
Sourcepub fn cursor_css(&self) -> &'static str
pub fn cursor_css(&self) -> &'static str
获取当前鼠标光标对应的标准 CSS cursor 字符串。
Auto Trait Implementations§
impl !Freeze for WebCanvasApp
impl !RefUnwindSafe for WebCanvasApp
impl !Send for WebCanvasApp
impl !Sync for WebCanvasApp
impl !UnwindSafe for WebCanvasApp
impl Forget for WebCanvasApp
impl Move for WebCanvasApp
impl Unpin for WebCanvasApp
impl UnsafeUnpin for WebCanvasApp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。