pub struct CanvasRenderingContext2D {}

Implementations

setter for property that specifies the color to use for the fills (outlines) around shapes. The default is black. see CanvasRenderingContext2D.fillStyle

Parameters
  • ‘r’ - value from 0 to 255 that represents how much red is in the color
  • ‘g’ - value from 0 to 255 that represents how much green is in the color
  • ‘b’ - value from 0 to 255 that represents how much blue is in the color
  • ‘a’ - value from 0 to 255 that represents how opaque the color is

getter for property that determines the shape used to join two line segments where they meet. see CanvasRenderingContext2D.lineJap

setter for property that determines the shape used to join two line segments where they meet. see CanvasRenderingContext2D.lineJoin

Parameters
  • ‘value’ - the type of line join. Valid options are Bevel, Round, Miter

getter for property that determines the shape used to draw the end points of lines. see CanvasRenderingContext2D.lineCap

setter for property that determines the shape used to draw the end points of lines. see CanvasRenderingContext2D.lineCap

Parameters
  • ‘value’ - the type of line cap. Valid options are Butt, Round, Square

getter for property that sets the thickness of lines. see CanvasRenderingContext2D.lineWidth

setter for property that sets the thickness of lines. see CanvasRenderingContext2D.lineWidth

Parameters
  • ‘value’ - the thickness of lines. Must be a non-zero positive number

setter for property that specifies the color to use for the strokes (outlines) around shapes. The default is black. see CanvasRenderingContext2D.strokeStyle

Parameters
  • ‘r’ - value from 0 to 255 that represents how much red is in the color
  • ‘g’ - value from 0 to 255 that represents how much green is in the color
  • ‘b’ - value from 0 to 255 that represents how much blue is in the color
  • ‘a’ - value from 0 to 255 that represents how opaque the color is

adds a circular arc to the current sub-path. see CanvasRenderingContext2D.arc

Parameters
  • ‘x’ - the horizontal coordinate of the arc’s center
  • ‘y’ - the vertical coordinate of the arc’s center
  • ‘radius’ - the arc’s radius. Must be positive
  • ‘start_angle’ - the angle at which the arc starts in radians, measured from the positive x-axis
  • ‘end_angle’ - the angle at which the arc ends in radians, measured from the positive x-axis
  • ‘counter_clockwise’ - if true, draws the arc counter-clockwise between the start and end angles

adds a circular arc to the current sub-path, using the given control points and radius. The arc is automatically connected to the path’s latest point with a straight line, if necessary for the specified parameters. see CanvasRenderingContext2D.arcTo

Parameters
  • ‘x1’ - the x-axis coordinate of the first control point
  • ‘y1’ - the y-axis coordinate of the first control point.
  • ‘x2’ - the x-axis coordinate of the second control point
  • ‘y2’ - the y-axis coordinate of the second control point.
  • ‘radius’ - the arc’s radius. Must be positive

starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path. see CanvasRenderingContext2D.beginPath

Parameters (none)

erases the pixels in a rectangular area by setting them to transparent black. see CanvasRenderingContext2D.clearRect

Parameters
  • ‘x’ - the x-axis coordinate of the rectangle’s starting point.
  • ‘y’ - the y-axis coordinate of the rectangle’s starting point.
  • ‘width’ - the rectangle’s width. Positive values are to the right, and negative to the left.
  • ‘height’ - the rectangle’s height. Positive values are down, and negative are up.

attempts to add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing.

This method doesn’t draw anything to the canvas directly. You can render the path using the stroke() or fill() methods. see CanvasRenderingContext2D.closePath

Parameters (none)

fills the current path with the current fillStyle

see CanvasRenderingContext2D.fill

Parameters (none)

draws a rectangle that is filled according to the current fillStyle.

This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it.

see CanvasRenderingContext2D.fillRect

Parameters
  • ‘x’ - the x-axis coordinate of the rectangle’s starting point.
  • ‘y’ - the y-axis coordinate of the rectangle’s starting point.
  • ‘width’ - the rectangle’s width. Positive values are to the right, and negative to the left.
  • ‘height’ - the rectangle’s height. Positive values are down, and negative are up.

adds a straight line to the current sub-path by connecting the sub-path’s last point to the specified (x, y) coordinates. see CanvasRenderingContext2D.lineTo

Parameters
  • ‘x’ - the x-axis coordinate of the line’s end point
  • ‘y’ - the y-axis coordinate of the line’s end point.

begins a new sub-path at the point specified by the given (x, y) coordinates. see CanvasRenderingContext2D.moveTo

Parameters
  • ‘x’ - the x-axis coordinate of the point
  • ‘y’ - the y-axis coordinate of the point.

strokes (outlines) the current or given path with the current stroke style. see CanvasRenderingContext2D.stroke

Parameters (none)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.