Struct conrod::backend::graphics::Context
[−]
pub struct Context { pub viewport: Option<Viewport>, pub view: [[f64; 3]; 2], pub transform: [[f64; 3]; 2], pub draw_state: DrawState, }
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
fn new() -> Context
Creates a new drawing context.
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.
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.
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.
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.
fn store_view(self) -> Context
Stores the current transform as new view.
fn get_view_size(&self) -> [f64; 2]
Computes the current view size.
Trait Implementations
impl Transformed for Context
fn append_transform(self, transform: [[f64; 3]; 2]) -> Context
Appends transform to the current one.
fn prepend_transform(self, transform: [[f64; 3]; 2]) -> Context
Prepends transform to the current one.
fn trans(self, x: f64, y: f64) -> Context
Translate x an y in local coordinates.
fn rot_rad(self, angle: f64) -> Context
Rotate radians in local coordinates.
fn orient(self, x: f64, y: f64) -> Context
Orients x axis to look at point locally. Read more
fn scale(self, sx: f64, sy: f64) -> Context
Scales in local coordinates.
fn shear(self, v: [f64; 2]) -> Context
Shears in local coordinates.
fn rot_deg(self, angle: f64) -> Self
Rotates degrees 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.
impl Clone for Context
fn clone(&self) -> Context
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more