Trait softbuffer::SurfaceExtWeb
source · pub trait SurfaceExtWeb: Sized {
// Required methods
fn from_canvas(canvas: HtmlCanvasElement) -> Result<Self, SoftBufferError>;
fn from_offscreen_canvas(
offscreen_canvas: OffscreenCanvas
) -> Result<Self, SoftBufferError>;
}Available on WebAssembly only.
Expand description
Extension methods for the Wasm target on Surface.
Required Methods§
sourcefn from_canvas(canvas: HtmlCanvasElement) -> Result<Self, SoftBufferError>
fn from_canvas(canvas: HtmlCanvasElement) -> Result<Self, SoftBufferError>
Creates a new instance of this struct, using the provided HtmlCanvasElement.
Errors
- If the canvas was already controlled by an
OffscreenCanvas. - If a another context then “2d” was already created for this canvas.
sourcefn from_offscreen_canvas(
offscreen_canvas: OffscreenCanvas
) -> Result<Self, SoftBufferError>
fn from_offscreen_canvas( offscreen_canvas: OffscreenCanvas ) -> Result<Self, SoftBufferError>
Creates a new instance of this struct, using the provided HtmlCanvasElement.
Errors
If a another context then “2d” was already created for this canvas.
Object Safety§
This trait is not object safe.