[−]Struct conrod_piston::draw::Context
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.
Methods
impl Context
pub fn new() -> Context
Creates a new drawing context.
pub fn new_viewport(viewport: Viewport) -> 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.
pub fn new_abs(w: f64, h: f64) -> Context
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
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
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
Stores the current transform as new view.
pub fn get_view_size(&self) -> [f64; 2]
Computes the current view size.
Trait Implementations
impl Copy for Context
impl Clone for Context
fn clone(&self) -> Context
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Transformed for Context
fn append_transform(self, transform: [[f64; 3]; 2]) -> Context
fn prepend_transform(self, transform: [[f64; 3]; 2]) -> Context
fn trans(self, x: f64, y: f64) -> Context
fn rot_rad(self, angle: f64) -> Context
fn orient(self, x: f64, y: f64) -> Context
fn scale(self, sx: f64, sy: f64) -> Context
fn shear(self, x: f64, y: f64) -> Context
fn rot_deg(self, angle: f64) -> Self
Rotates degrees in local coordinates.
fn trans_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
P: Into<[f64; 2]>,
Translate position in local coordinates.
fn orient_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
P: Into<[f64; 2]>,
Orients x axis to look at point locally.
fn scale_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
P: Into<[f64; 2]>,
Scales in local coordinates.
fn zoom(self, s: f64) -> Self
Scales in both directions in local coordinates.
fn flip_v(self) -> Self
Flips vertically in local coordinates.
fn flip_h(self) -> Self
Flips horizontally in local coordinates.
fn flip_hv(self) -> Self
Flips horizontally and vertically in local coordinates.
fn shear_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
P: Into<[f64; 2]>,
Shears in local coordinates.
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,