pub struct Canvas2dChartBackend { /* private fields */ }Expand description
The Canvas2D rendering backend.
This is the universal fallback: it works in every browser, including ones with neither WebGPU nor WebGL2. It replays the display list as immediate-mode canvas calls, which is slower than the GPU backends but produces exactly the same picture.
Implementations§
Source§impl Canvas2dChartBackend
Inherent implementation of Canvas2dChartBackend.
impl Canvas2dChartBackend
Inherent implementation of Canvas2dChartBackend.
Sourcepub fn create(canvas: &HtmlCanvasElement) -> Option<Self>
pub fn create(canvas: &HtmlCanvasElement) -> Option<Self>
Creates a backend around the given canvas.
Returns None when the canvas cannot give out a 2D context — in
practice, when the canvas already has a WebGPU or WebGL context.
§Arguments
&HtmlCanvasElement- Shared reference to aHtmlCanvasElement.
§Returns
Option<Self>-Some(...)on success,Noneotherwise.
Sourcepub fn canvas(&self) -> &HtmlCanvasElement
pub fn canvas(&self) -> &HtmlCanvasElement
Trait Implementations§
Source§impl ChartBackend for Canvas2dChartBackend
Implements ChartBackend for Canvas2dChartBackend.
impl ChartBackend for Canvas2dChartBackend
Implements ChartBackend for Canvas2dChartBackend.
Source§fn kind(&self) -> BackendKind
fn kind(&self) -> BackendKind
Source§fn render(&mut self, list: &DisplayList, shaper: &mut TextShaper)
fn render(&mut self, list: &DisplayList, shaper: &mut TextShaper)
Implements the render operation on Canvas2dChartBackend.
§Arguments
&DisplayList- Shared reference to aDisplayList.&mut TextShaper- Mutable reference to aTextShaper(mutated in place).
Source§fn dispose(&mut self)
fn dispose(&mut self)
Implements the dispose operation on Canvas2dChartBackend.
Source§impl Clone for Canvas2dChartBackend
impl Clone for Canvas2dChartBackend
Auto Trait Implementations§
impl Freeze for Canvas2dChartBackend
impl RefUnwindSafe for Canvas2dChartBackend
impl Send for Canvas2dChartBackend
impl Sync for Canvas2dChartBackend
impl Unpin for Canvas2dChartBackend
impl UnsafeUnpin for Canvas2dChartBackend
impl UnwindSafe for Canvas2dChartBackend
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