pub struct WebRenderContext<'a> { /* private fields */ }

Implementations§

source§

impl WebRenderContext<'_>

source

pub fn new(
    ctx: CanvasRenderingContext2d,
    window: Window
) -> WebRenderContext<'static>

Trait Implementations§

source§

impl RenderContext for WebRenderContext<'_>

§

type Brush = Brush

wasm-bindgen doesn’t have a native Point type, so use kurbo’s.

§

type Text = WebText

An associated factory for creating text layouts and related resources.
§

type TextLayout = WebTextLayout

The type use to represent text layout objects.
§

type Image = WebImage

The associated type of an image.
source§

fn status(&mut self) -> Result<(), Error>

Report an internal error. Read more
source§

fn clear(&mut self, region: impl Into<Option<Rect>>, color: Color)

Replace a region of the canvas with the provided Color. Read more
source§

fn solid_brush(&mut self, color: Color) -> Brush

Create a new brush resource. Read more
source§

fn gradient(
    &mut self,
    gradient: impl Into<FixedGradient>
) -> Result<Brush, Error>

Create a new gradient brush.
source§

fn fill(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>)

Fill a [Shape], using the non-zero fill rule.
source§

fn fill_even_odd(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>)

Fill a shape, using the even-odd fill rule.
source§

fn clip(&mut self, shape: impl Shape)

Clip to a [Shape]. Read more
source§

fn stroke(&mut self, shape: impl Shape, brush: &impl IntoBrush<Self>, width: f64)

Stroke a [Shape], using the default StrokeStyle.
source§

fn stroke_styled(
    &mut self,
    shape: impl Shape,
    brush: &impl IntoBrush<Self>,
    width: f64,
    style: &StrokeStyle
)

Stroke a [Shape], providing a custom StrokeStyle.
source§

fn text(&mut self) -> &mut Self::Text

Returns a reference to a shared Text object. Read more
source§

fn draw_text(&mut self, layout: &Self::TextLayout, pos: impl Into<Point>)

source§

fn save(&mut self) -> Result<(), Error>

Save the context state. Read more
source§

fn restore(&mut self) -> Result<(), Error>

Restore the context state. Read more
source§

fn finish(&mut self) -> Result<(), Error>

Finish any pending operations. Read more
source§

fn transform(&mut self, transform: Affine)

Apply a transform. Read more
source§

fn current_transform(&self) -> Affine

Returns the transformations currently applied to the context.
source§

fn make_image(
    &mut self,
    width: usize,
    height: usize,
    buf: &[u8],
    format: ImageFormat
) -> Result<Self::Image, Error>

Create a new Image from a pixel buffer. Read more
source§

fn draw_image(
    &mut self,
    image: &Self::Image,
    dst_rect: impl Into<Rect>,
    interp: InterpolationMode
)

Draw an Image into the provided [Rect]. Read more
source§

fn draw_image_area(
    &mut self,
    image: &Self::Image,
    src_rect: impl Into<Rect>,
    dst_rect: impl Into<Rect>,
    interp: InterpolationMode
)

Draw a specified area of an Image. Read more
source§

fn capture_image_area(
    &mut self,
    _rect: impl Into<Rect>
) -> Result<Self::Image, Error>

Create an Image of the specified region of the context. Read more
source§

fn blurred_rect(
    &mut self,
    rect: Rect,
    blur_radius: f64,
    brush: &impl IntoBrush<Self>
)

Draw a rectangle with Gaussian blur. Read more
source§

fn with_save(
    &mut self,
    f: impl FnOnce(&mut Self) -> Result<(), Error>
) -> Result<(), Error>

Do graphics operations with the context state saved and then restored. Read more
source§

impl IntoBrush<WebRenderContext<'_>> for Brush

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for WebRenderContext<'a>

§

impl<'a> !Send for WebRenderContext<'a>

§

impl<'a> !Sync for WebRenderContext<'a>

§

impl<'a> Unpin for WebRenderContext<'a>

§

impl<'a> !UnwindSafe for WebRenderContext<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> RoundFrom<T> for T

source§

fn round_from(x: T) -> T

Performs the conversion.
source§

impl<T, U> RoundInto<U> for Twhere
    U: RoundFrom<T>,

source§

fn round_into(self) -> U

Performs the conversion.
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.