Struct graphics::context::Context [−][src]
pub struct Context { pub viewport: Option<Viewport>, pub view: Matrix2d, pub transform: Matrix2d, pub draw_state: DrawState, }
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
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: Scalar, h: Scalar) -> 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) -> Self
[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) -> Self
[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) -> Self
[src]
Stores the current transform as new view.
pub fn get_view_size(&self) -> Vec2d
[src]
Computes the current view size.
Trait Implementations
impl Clone for Context
[src]
impl Copy for Context
[src]
impl Transformed for Context
[src]
fn append_transform(self, transform: Matrix2d) -> Self
[src]
fn prepend_transform(self, transform: Matrix2d) -> Self
[src]
fn trans(self, x: Scalar, y: Scalar) -> Self
[src]
fn rot_rad(self, angle: Scalar) -> Self
[src]
fn orient(self, x: Scalar, y: Scalar) -> Self
[src]
fn scale(self, sx: Scalar, sy: Scalar) -> Self
[src]
fn shear(self, x: Scalar, y: Scalar) -> Self
[src]
fn rot_deg(self, angle: Scalar) -> Self
[src]
fn trans_pos<P: Into<Vec2d>>(self, pos: P) -> Self
[src]
fn orient_pos<P: Into<Vec2d>>(self, pos: P) -> Self
[src]
fn scale_pos<P: Into<Vec2d>>(self, pos: P) -> Self
[src]
fn zoom(self, s: Scalar) -> Self
[src]
fn flip_v(self) -> Self
[src]
fn flip_h(self) -> Self
[src]
fn flip_hv(self) -> Self
[src]
fn shear_pos<P: Into<Vec2d>>(self, pos: P) -> Self
[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]
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> 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>,