[−][src]Struct canrust::canvas::Rectangle
Representation of a Rectangle object.
Implementations
impl Rectangle
[src]
pub fn new(size: (f32, f32), position: (f32, f32), color: Color) -> Option<Self>
[src]
Creates new Rectangle object. Requires from two tuples of f32s and a Color
pub fn from_rect(rect: &Rectangle) -> Option<Self>
[src]
Creates a new Rectangle object from an existing one
impl Rectangle
[src]
pub fn set_fill_color(&mut self, color: Color) -> Result<(), String>
[src]
Set fill color of the Rectangle
pub fn set_outline_color(&mut self, color: Color) -> Result<(), String>
[src]
Set outline color of the Rectangle
pub fn set_outline_thickness(&mut self, size: f32) -> Result<(), String>
[src]
Set outline thickness of the Rectangle
pub fn set_position(&mut self, position: (f32, f32)) -> Result<(), String>
[src]
Set objects position on the Canvas
pub fn set_size(&mut self, size: (f32, f32)) -> Result<(), String>
[src]
Set the size of the object on Canvas
pub fn set_rotation(&mut self, angle: f32) -> Result<(), String>
[src]
Rotates the object by a given angle from its origin point, which is in its middle by default.
pub fn rotate(&mut self, angle: f32) -> Result<(), String>
[src]
This adds to the objects rotation, unlike no_run set_rotation()
method which overwrites objects rotation.
pub fn set_origin(&mut self, position: (f32, f32)) -> Result<(), String>
[src]
Sets shapes origin point(by default its the top left corner, or objects 0, 0 coordinates). This is the point, around which objects rotate and which will be used to set objects position.
If if you have a Rectangle with the default origin point which is 0, 0 on position x = 320 and y = 180 and width and height of 80 and 100 pixels, valid origin points are coordinates x+width and y + height.
pub fn get_fill_color(&self) -> Option<Color>
[src]
Returns fill color of the object
pub fn get_outline_color(&self) -> Option<Color>
[src]
Return the outline color of the object
pub fn get_outline_thickness(&self) -> Option<f32>
[src]
Returns the outline thickness of the object
pub fn get_size(&self) -> Option<(f32, f32)>
[src]
Returns objects size
pub fn get_position(&self) -> Option<(f32, f32)>
[src]
Returns objects position on the Canvas
pub fn get_rotation(&self) -> Option<f32>
[src]
Returns the angle at which the object is rotated.
pub fn get_origin(&self) -> Option<(f32, f32)>
[src]
Returns the objects origin point.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Rectangle
impl !Send for Rectangle
impl !Sync for Rectangle
impl Unpin for Rectangle
impl UnwindSafe for Rectangle
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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,