mirror of
https://github.com/emilk/egui.git
synced 2026-07-14 18:48:54 +00:00
30 lines
984 B
Rust
30 lines
984 B
Rust
use wasm_bindgen::JsValue;
|
|
|
|
/// Renderer for a browser canvas.
|
|
/// As of writing we're not allowing to decide on the painter at runtime,
|
|
/// therefore this trait is merely there for specifying and documenting the interface.
|
|
pub(crate) trait WebPainter {
|
|
// Create a new web painter targeting a given canvas.
|
|
// fn new(canvas: HtmlCanvasElement, options: &WebOptions) -> Result<Self, String>
|
|
// where
|
|
// Self: Sized;
|
|
|
|
/// Reference to the canvas in use.
|
|
fn canvas(&self) -> &web_sys::HtmlCanvasElement;
|
|
|
|
/// Maximum size of a texture in one direction.
|
|
fn max_texture_side(&self) -> usize;
|
|
|
|
/// Update all internal textures and paint gui.
|
|
fn paint_and_update_textures(
|
|
&mut self,
|
|
clear_color: [f32; 4],
|
|
clipped_primitives: &[egui::ClippedPrimitive],
|
|
pixels_per_point: f32,
|
|
textures_delta: &egui::TexturesDelta,
|
|
) -> Result<(), JsValue>;
|
|
|
|
/// Destroy all resources.
|
|
fn destroy(&mut self);
|
|
}
|