Struct graphics::context::Context

source ·
pub struct Context {
    pub viewport: Option<Viewport>,
    pub view: Matrix2d,
    pub transform: Matrix2d,
    pub draw_state: DrawState,
}
Expand description

Drawing 2d context.

Fields

viewport: Option<Viewport>

Viewport information.

view: Matrix2d

View transformation.

transform: Matrix2d

Current transformation.

draw_state: DrawState

Current draw state settings.

Implementations

Creates a new drawing context.

Creates a new context with absolute transform in point coordinates.

This function assumes the default coordinate system being centered with x axis pointing to the right and y axis pointing up.

Returns a drawing context with origin in the upper left corner and x axis pointing to the right and y axis pointing down.

Creates a new drawing context in absolute coordinates.

This function assumes the default coordinate system being centered with x axis pointing to the right and y axis pointing up.

Returns a drawing context with origin in the upper left corner and x axis pointing to the right and y axis pointing down.

Moves the current transform to the view coordinate system.

This is usually [0.0, 0.0] in the upper left corner with the x axis pointing to the right and the y axis pointing down.

Moves the current transform to the default coordinate system.

This is usually [0.0, 0.0] in the center with the x axis pointing to the right and the y axis pointing up.

Stores the current transform as new view.

Computes the current view size.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Appends transform to the current one.
Prepends transform to the current one.
Translate x and y in local coordinates.
Rotate radians in local coordinates.
Orients x axis to look at point locally. Read more
Scales in local coordinates.
Shears in local coordinates.
Rotates degrees in local coordinates.
Scales in both directions in local coordinates.
Flips vertically in local coordinates.
Flips horizontally in local coordinates.
Flips horizontally and vertically in local coordinates.

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.