Struct Canvas

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

Implementations§

Source§

impl<'a> Canvas<'a>

Source

pub fn new(ctx: &'a Context) -> Self

Trait Implementations§

Source§

impl<'a> CanvasContext for Canvas<'a>

Source§

type Pattern = Pattern

Source§

fn get_direction(&self) -> Direction

Get direction
Source§

fn set_direction(&self, value: Direction) -> String

Set direction
Source§

fn set_fill_color(&self, value: Color)

Set fill color
Source§

fn set_fill_gradient(&self, value: &Gradient)

Set fill gradient
Source§

fn set_fill_pattern(&self, value: &Self::Pattern)

Set fill pattern
Source§

fn get_filter(&self) -> String

Get filter
Source§

fn set_filter(&self, value: &str)

Set filter
Source§

fn get_font(&self) -> String

Get font
Source§

fn set_font( &self, family: &str, style: TextStyle, weight: TextWeight, size: f64, )

Set direction
Source§

fn get_global_alpha(&self) -> f64

Get global alpha
Source§

fn set_global_alpha(&self, value: f64)

Set global alpha
Source§

fn get_global_composite_operation(&self) -> String

Get global composite operation
Source§

fn set_global_composite_operation(&self, value: &str)

Set global composite operation
Source§

fn is_image_smoothing_enabled(&self) -> bool

Whether images and patterns on this canvas will be smoothed when this canvas is scaled.
Source§

fn set_image_smoothing(&self, value: bool)

Set image smoothing
Source§

fn get_line_cap(&self) -> LineCap

Get line cap
Source§

fn set_line_cap(&self, value: LineCap)

Set line cap
Source§

fn get_line_dash_offset(&self) -> f64

Get line dash offset
Source§

fn set_line_dash_offset(&self, value: f64)

Set line dash offset
Source§

fn get_line_join(&self) -> LineJoin

Get line join
Source§

fn set_line_join(&self, value: LineJoin)

Set line dash
Source§

fn get_line_width(&self) -> f64

Get line width
Source§

fn set_line_width(&self, value: f64)

Set line width
Source§

fn get_miter_limit(&self) -> f64

Get miter limit
Source§

fn set_miter_limit(&self, value: f64)

Set miter limit
Source§

fn get_shadow_blur(&self) -> f64

Get shadow blur
Source§

fn set_shadow_blur(&self, value: f64)

Set shadow blur
Source§

fn get_shadow_color(&self) -> Color

Get shadow color
Source§

fn set_shadow_color(&self, value: Color)

Set shadow color
Source§

fn get_shadow_offset_x(&self) -> f64

Get shadow offset x
Source§

fn set_shadow_offset_x(&self, value: f64)

Set shadow offset x
Source§

fn get_shadow_offset_y(&self) -> f64

Get shadow offset y
Source§

fn set_shadow_offset_y(&self, value: f64)

Set shadow offset y
Source§

fn set_stroke_color(&self, value: Color)

Set stroke color
Source§

fn set_stroke_gradient(&self, value: &Gradient)

Set stroke gradient
Source§

fn set_stroke_pattern(&self, value: &Self::Pattern)

Set stroke pattern
Source§

fn get_text_align(&self) -> TextAlign

Get text align
Source§

fn set_text_align(&self, value: TextAlign)

Set text align
Source§

fn get_text_baseline(&self) -> BaseLine

Get text baseline
Source§

fn set_text_baseline(&self, value: BaseLine)

Set text baseline
Source§

fn arc( &self, x: f64, y: f64, radius: f64, start_angle: f64, end_angle: f64, anticlockwise: bool, )

Add arc to current path with anticlockwise param
Source§

fn arc_to(&self, x1: f64, y1: f64, x2: f64, y2: f64, radius: f64)

Add arc to current path
Source§

fn begin_path(&self)

Begin the path
Source§

fn bezier_curve_to( &self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64, )

Add bezier curve to current path
Source§

fn clear_rect(&self, x: f64, y: f64, width: f64, height: f64)

Clear rectangle on current canvas
Source§

fn close_path(&self)

Close the current path
Source§

fn ellipse( &self, x: f64, y: f64, radius_x: f64, radius_y: f64, rotation: f64, start_angle: f64, end_angle: f64, anticlockwise: bool, )

Add ellipse to current path
Source§

fn fill(&self)

Fill current path
Source§

fn fill_rect(&self, x: f64, y: f64, width: f64, height: f64)

Fill rectangle
Source§

fn fill_text(&self, text: &str, x: f64, y: f64)

Draws text to the canvas.
Source§

fn get_line_dash(&self) -> Vec<f64>

Get line dash
Source§

fn line_to(&self, x: f64, y: f64)

Add line to path from current position
Source§

fn measure_text(&self, text: &str) -> TextMetrics

Measure text using current font face and font size
Source§

fn move_to(&self, x: f64, y: f64)

Move cursor to position
Source§

fn quadratic_curve_to(&self, cpx: f64, cpy: f64, x: f64, y: f64)

Add quadratic curve to current path
Source§

fn rect(&self, x: f64, y: f64, width: f64, height: f64)

Add rectangle to current path
Source§

fn reset_transform(&self)

Reset current transformations
Source§

fn restore(&self)

Restore transformations
Source§

fn rotate(&self, angle: f64)

Add rotate to current transformations
Source§

fn save(&self)

Save current transformations
Source§

fn scale(&self, x: f64, y: f64)

Add scle to current transformations
Source§

fn set_line_dash(&self, dash: &Vec<f64>)

Set line dash
Source§

fn set_transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)

Set transform matrix
Source§

fn stroke(&self)

Stroke current path
Source§

fn stroke_rect(&self, x: f64, y: f64, width: f64, height: f64)

Stroke rectangle
Source§

fn stroke_text(&self, text: &str, x: f64, y: f64)

Stroke text
Source§

fn transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)

Add transform matrix to current transformations
Source§

fn translate(&self, x: f64, y: f64)

Add translate to current transformations

Auto Trait Implementations§

§

impl<'a> !Freeze for Canvas<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for Canvas<'a>

§

impl<'a> UnwindSafe for Canvas<'a>

Blanket Implementations§

Source§

impl<O> AdvancedShapesExt for O
where O: CanvasContext,

Source§

fn round_rect(&self, x: f64, y: f64, width: f64, height: f64, radius: f64)

Source§

fn polygon(&self, x: f64, y: f64, radius: f64, n: usize)

Source§

fn star(&self, x: f64, y: f64, points: usize, outer: f64, inner: f64)

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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<Fr, To> IntoColor<To> for Fr
where To: FromColor<Fr>,

Source§

fn into_color(self) -> To

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V