Trait primitives::CanvasContext[][src]

pub trait CanvasContext {
    type Pattern;
Show methods fn get_direction(&self) -> Direction;
fn set_direction(&self, value: Direction) -> String;
fn set_fill_color(&self, value: Color);
fn set_fill_gradient(&self, value: &Gradient);
fn set_fill_pattern(&self, value: &Self::Pattern);
fn get_filter(&self) -> String;
fn set_filter(&self, value: &str);
fn get_font(&self) -> String;
fn set_font(
        &self,
        family: &str,
        style: TextStyle,
        weight: TextWeight,
        size: f64
    );
fn get_global_alpha(&self) -> f64;
fn set_global_alpha(&self, value: f64);
fn get_global_composite_operation(&self) -> String;
fn set_global_composite_operation(&self, value: &str);
fn is_image_smoothing_enabled(&self) -> bool;
fn set_image_smoothing(&self, value: bool);
fn get_line_cap(&self) -> LineCap;
fn set_line_cap(&self, value: LineCap);
fn get_line_dash_offset(&self) -> f64;
fn set_line_dash_offset(&self, value: f64);
fn get_line_join(&self) -> LineJoin;
fn set_line_join(&self, value: LineJoin);
fn get_line_width(&self) -> f64;
fn set_line_width(&self, value: f64);
fn get_miter_limit(&self) -> f64;
fn set_miter_limit(&self, value: f64);
fn get_shadow_blur(&self) -> f64;
fn set_shadow_blur(&self, value: f64);
fn get_shadow_color(&self) -> Color;
fn set_shadow_color(&self, value: Color);
fn get_shadow_offset_x(&self) -> f64;
fn set_shadow_offset_x(&self, value: f64);
fn get_shadow_offset_y(&self) -> f64;
fn set_shadow_offset_y(&self, value: f64);
fn set_stroke_color(&self, value: Color);
fn set_stroke_gradient(&self, value: &Gradient);
fn set_stroke_pattern(&self, value: &Self::Pattern);
fn get_text_align(&self) -> TextAlign;
fn set_text_align(&self, value: TextAlign);
fn get_text_baseline(&self) -> BaseLine;
fn set_text_baseline(&self, value: BaseLine);
fn arc(
        &self,
        x: f64,
        y: f64,
        radius: f64,
        start_angle: f64,
        end_angle: f64,
        anticlockwise: bool
    );
fn arc_to(&self, x1: f64, y1: f64, x2: f64, y2: f64, radius: f64);
fn begin_path(&self);
fn bezier_curve_to(
        &self,
        cp1x: f64,
        cp1y: f64,
        cp2x: f64,
        cp2y: f64,
        x: f64,
        y: f64
    );
fn clear_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn close_path(&self);
fn ellipse(
        &self,
        x: f64,
        y: f64,
        radius_x: f64,
        radius_y: f64,
        rotation: f64,
        start_angle: f64,
        end_angle: f64,
        anticlockwise: bool
    );
fn fill(&self);
fn fill_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn fill_text(&self, text: &str, x: f64, y: f64);
fn get_line_dash(&self) -> Vec<f64>;
fn line_to(&self, x: f64, y: f64);
fn measure_text(&self, text: &str) -> TextMetrics;
fn move_to(&self, x: f64, y: f64);
fn quadratic_curve_to(&self, cpx: f64, cpy: f64, x: f64, y: f64);
fn rect(&self, x: f64, y: f64, width: f64, height: f64);
fn reset_transform(&self);
fn restore(&self);
fn rotate(&self, angle: f64);
fn save(&self);
fn scale(&self, x: f64, y: f64);
fn set_line_dash(&self, dash: &Vec<f64>);
fn set_transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64);
fn stroke(&self);
fn stroke_rect(&self, x: f64, y: f64, width: f64, height: f64);
fn stroke_text(&self, text: &str, x: f64, y: f64);
fn transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64);
fn translate(&self, x: f64, y: f64);
}

Associated Types

Loading content...

Required methods

fn get_direction(&self) -> Direction[src]

Get direction

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

Set direction

fn set_fill_color(&self, value: Color)[src]

Set fill color

fn set_fill_gradient(&self, value: &Gradient)[src]

Set fill gradient

fn set_fill_pattern(&self, value: &Self::Pattern)[src]

Set fill pattern

fn get_filter(&self) -> String[src]

Get filter

fn set_filter(&self, value: &str)[src]

Set filter

fn get_font(&self) -> String[src]

Get font

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

Set direction

fn get_global_alpha(&self) -> f64[src]

Get global alpha

fn set_global_alpha(&self, value: f64)[src]

Set global alpha

fn get_global_composite_operation(&self) -> String[src]

Get global composite operation

fn set_global_composite_operation(&self, value: &str)[src]

Set global composite operation

fn is_image_smoothing_enabled(&self) -> bool[src]

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

fn set_image_smoothing(&self, value: bool)[src]

Set image smoothing

fn get_line_cap(&self) -> LineCap[src]

Get line cap

fn set_line_cap(&self, value: LineCap)[src]

Set line cap

fn get_line_dash_offset(&self) -> f64[src]

Get line dash offset

fn set_line_dash_offset(&self, value: f64)[src]

Set line dash offset

fn get_line_join(&self) -> LineJoin[src]

Get line join

fn set_line_join(&self, value: LineJoin)[src]

Set line dash

fn get_line_width(&self) -> f64[src]

Get line width

fn set_line_width(&self, value: f64)[src]

Set line width

fn get_miter_limit(&self) -> f64[src]

Get miter limit

fn set_miter_limit(&self, value: f64)[src]

Set miter limit

fn get_shadow_blur(&self) -> f64[src]

Get shadow blur

fn set_shadow_blur(&self, value: f64)[src]

Set shadow blur

fn get_shadow_color(&self) -> Color[src]

Get shadow color

fn set_shadow_color(&self, value: Color)[src]

Set shadow color

fn get_shadow_offset_x(&self) -> f64[src]

Get shadow offset x

fn set_shadow_offset_x(&self, value: f64)[src]

Set shadow offset x

fn get_shadow_offset_y(&self) -> f64[src]

Get shadow offset y

fn set_shadow_offset_y(&self, value: f64)[src]

Set shadow offset y

fn set_stroke_color(&self, value: Color)[src]

Set stroke color

fn set_stroke_gradient(&self, value: &Gradient)[src]

Set stroke gradient

fn set_stroke_pattern(&self, value: &Self::Pattern)[src]

Set stroke pattern

fn get_text_align(&self) -> TextAlign[src]

Get text align

fn set_text_align(&self, value: TextAlign)[src]

Set text align

fn get_text_baseline(&self) -> BaseLine[src]

Get text baseline

fn set_text_baseline(&self, value: BaseLine)[src]

Set text baseline

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

Add arc to current path with anticlockwise param

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

Add arc to current path

fn begin_path(&self)[src]

Begin the path

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

Add bezier curve to current path

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

Clear rectangle on current canvas

fn close_path(&self)[src]

Close the current path

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

Add ellipse to current path

fn fill(&self)[src]

Fill current path

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

Fill rectangle

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

Draws text to the canvas.

fn get_line_dash(&self) -> Vec<f64>[src]

Get line dash

fn line_to(&self, x: f64, y: f64)[src]

Add line to path from current position

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

Measure text using current font face and font size

fn move_to(&self, x: f64, y: f64)[src]

Move cursor to position

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

Add quadratic curve to current path

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

Add rectangle to current path

fn reset_transform(&self)[src]

Reset current transformations

fn restore(&self)[src]

Restore transformations

fn rotate(&self, angle: f64)[src]

Add rotate to current transformations

fn save(&self)[src]

Save current transformations

fn scale(&self, x: f64, y: f64)[src]

Add scle to current transformations

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

Set line dash

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

Set transform matrix

fn stroke(&self)[src]

Stroke current path

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

Stroke rectangle

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

Stroke text

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

Add transform matrix to current transformations

fn translate(&self, x: f64, y: f64)[src]

Add translate to current transformations

Loading content...

Implementors

Loading content...