lux::graphics

Struct Ellipse

Source
pub struct Ellipse<'a, C: 'a> { /* private fields */ }
Expand description

An ellipse that can be drawn to the screen.

Implementations§

Source§

impl<'a, C> Ellipse<'a, C>

Source

pub fn segments(&mut self, segments: u16) -> &mut Self

Sets the number of segments that are used to approximate a circle.

§Example
use lux::prelude::*;
use lux::graphics::ColorVertex;

let mut window = Window::new().unwrap();
let mut frame = window.frame();
let (x, y, size) = (10.0, 10.0, 50.0);
// draw a pentagon
frame.circle(x, y, size).segments(5).draw();
Source

pub fn line_length(&mut self, line_length: u16) -> &mut Self

Instead of

Source§

impl<'a, C> Ellipse<'a, C>
where C: Canvas + 'a,

Source

pub fn fill(&mut self)

Fills in the ellipse with a solid color.

Trait Implementations§

Source§

impl<'a, C> Colored for Ellipse<'a, C>

Source§

fn get_color(&self) -> [Float; 4]

Returns the current color.
Source§

fn color<A: Color>(&mut self, color: A) -> &mut Self

Sets the color.
Source§

fn with_color<F, R, C: Color>(&mut self, color: C, f: F)
where F: FnOnce(&mut Self) -> R,

Executes a closure with the given color, then resets it to what it was before. Read more
Source§

impl<'a, C> Transform for Ellipse<'a, C>

Source§

fn current_matrix(&self) -> &[[Float; 4]; 4]

Return a reference to the current matrix.
Source§

fn current_matrix_mut(&mut self) -> &mut [[Float; 4]; 4]

Return a mutible reference to the current matrix.
Source§

fn apply_matrix(&mut self, other: [[Float; 4]; 4]) -> &mut Self

Multiplies the current matrix against another. self = self * other.
Source§

fn translate(&mut self, dx: Float, dy: Float) -> &mut Self

Applies a translation transformation to the matrix.
Source§

fn scale(&mut self, sx: Float, sy: Float) -> &mut Self

Applies a scaling transformation to the matrix.
Source§

fn shear(&mut self, sx: Float, sy: Float) -> &mut Self

Applies a shearing transformation to the matrix.
Source§

fn rotate(&mut self, theta: Float) -> &mut Self

Applies a rotation transformation to the matrix.
Source§

fn rotate_around(&mut self, point: (Float, Float), theta: Float) -> &mut Self

Combines rotation with translation to effectively rotate around a given point.
Source§

fn with_matrix<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Used when you want to make several successive calls to transformations on a single stacked matrix. Read more
Source§

fn with_rotation<F, R>(&mut self, rotation: Float, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Similar to with_matrix but with a rotation applied for the duration of the closure.
Source§

fn with_translate<F, R>(&mut self, dx: Float, dy: Float, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Similar to with_matrix but with a translation applied for the duration of the closure.
Source§

fn with_scale<F, R>(&mut self, scale_x: Float, scale_y: Float, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Similar to with_matrix but with a scale applied for the duration of the closure.
Source§

fn with_shear<F, R>(&mut self, sx: Float, sy: Float, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Similar to with_matrix but with a shear applied for the duration of the closure.
Source§

fn with_rotate_around<F, R>( &mut self, point: (Float, Float), theta: Float, f: F, ) -> R
where F: FnOnce(&mut Self) -> R,

Similar to with_matrix but with rotate_around applied for the duration of the closure.

Auto Trait Implementations§

§

impl<'a, C> Freeze for Ellipse<'a, C>

§

impl<'a, C> RefUnwindSafe for Ellipse<'a, C>
where C: RefUnwindSafe,

§

impl<'a, C> Send for Ellipse<'a, C>
where C: Send,

§

impl<'a, C> Sync for Ellipse<'a, C>
where C: Sync,

§

impl<'a, C> Unpin for Ellipse<'a, C>

§

impl<'a, C> !UnwindSafe for Ellipse<'a, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.