Struct conrod_piston::draw::Context[][src]

pub struct Context {
    pub viewport: Option<Viewport>,
    pub view: [[f64; 3]; 2],
    pub transform: [[f64; 3]; 2],
    pub draw_state: DrawState,
}
Expand description

Drawing 2d context.

Fields

viewport: Option<Viewport>

Viewport information.

view: [[f64; 3]; 2]

View transformation.

transform: [[f64; 3]; 2]

Current transformation.

draw_state: DrawState

Current draw state settings.

Implementations

impl Context[src]

pub fn new() -> Context[src]

Creates a new drawing context.

pub fn new_viewport(viewport: Viewport) -> Context[src]

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.

pub fn new_abs(w: f64, h: f64) -> Context[src]

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.

pub fn view(self) -> Context[src]

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.

pub fn reset(self) -> Context[src]

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.

pub fn store_view(self) -> Context[src]

Stores the current transform as new view.

pub fn get_view_size(&self) -> [f64; 2][src]

Computes the current view size.

Trait Implementations

impl Clone for Context[src]

pub fn clone(&self) -> Context[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Transformed for Context[src]

pub fn append_transform(self, transform: [[f64; 3]; 2]) -> Context[src]

Appends transform to the current one.

pub fn prepend_transform(self, transform: [[f64; 3]; 2]) -> Context[src]

Prepends transform to the current one.

pub fn trans(self, x: f64, y: f64) -> Context[src]

Translate x and y in local coordinates.

pub fn rot_rad(self, angle: f64) -> Context[src]

Rotate radians in local coordinates.

pub fn orient(self, x: f64, y: f64) -> Context[src]

Orients x axis to look at point locally. Read more

pub fn scale(self, sx: f64, sy: f64) -> Context[src]

Scales in local coordinates.

pub fn shear(self, x: f64, y: f64) -> Context[src]

Shears in local coordinates.

fn rot_deg(self, angle: f64) -> Self[src]

Rotates degrees in local coordinates.

fn trans_pos<P>(self, pos: P) -> Self where
    P: Into<[f64; 2]>, 
[src]

Translate position in local coordinates.

fn orient_pos<P>(self, pos: P) -> Self where
    P: Into<[f64; 2]>, 
[src]

Orients x axis to look at point locally.

fn scale_pos<P>(self, pos: P) -> Self where
    P: Into<[f64; 2]>, 
[src]

Scales in local coordinates.

fn zoom(self, s: f64) -> Self[src]

Scales in both directions in local coordinates.

fn flip_v(self) -> Self[src]

Flips vertically in local coordinates.

fn flip_h(self) -> Self[src]

Flips horizontally in local coordinates.

fn flip_hv(self) -> Self[src]

Flips horizontally and vertically in local coordinates.

fn shear_pos<P>(self, pos: P) -> Self where
    P: Into<[f64; 2]>, 
[src]

Shears in local coordinates.

impl Copy for Context[src]

Auto Trait Implementations

impl RefUnwindSafe for Context

impl Send for Context

impl Sync for Context

impl Unpin for Context

impl UnwindSafe for Context

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.