[−][src]Struct piston_window::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.
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]
impl Copy for Context
[src]
impl Transformed for Context
[src]
pub fn append_transform(self, transform: [[f64; 3]; 2]) -> Context
[src]
pub fn prepend_transform(self, transform: [[f64; 3]; 2]) -> Context
[src]
pub fn trans(self, x: f64, y: f64) -> Context
[src]
pub fn rot_rad(self, angle: f64) -> Context
[src]
pub fn orient(self, x: f64, y: f64) -> Context
[src]
pub fn scale(self, sx: f64, sy: f64) -> Context
[src]
pub fn shear(self, x: f64, y: f64) -> Context
[src]
pub fn rot_deg(self, angle: f64) -> Self
[src]
pub fn trans_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
[src]
P: Into<[f64; 2]>,
pub fn orient_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
[src]
P: Into<[f64; 2]>,
pub fn scale_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
[src]
P: Into<[f64; 2]>,
pub fn zoom(self, s: f64) -> Self
[src]
pub fn flip_v(self) -> Self
[src]
pub fn flip_h(self) -> Self
[src]
pub fn flip_hv(self) -> Self
[src]
pub fn shear_pos<P>(self, pos: P) -> Self where
P: Into<[f64; 2]>,
[src]
P: Into<[f64; 2]>,
Auto Trait Implementations
impl RefUnwindSafe for Context
[src]
impl Send for Context
[src]
impl Sync for Context
[src]
impl Unpin for Context
[src]
impl UnwindSafe for Context
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,