Struct tetra::graphics::DrawParams [−][src]
pub struct DrawParams { pub position: Vec2<f32>, pub scale: Vec2<f32>, pub origin: Vec2<f32>, pub rotation: f32, pub color: Color, }
Expand description
Parameters that can be manipulated when drawing an object.
You can either use this as a builder by calling DrawParams::new
and then chaining methods, or
construct it manually - whichever you find more pleasant to write.
Fields
position: Vec2<f32>
Expand description
The position that the graphic should be drawn at. Defaults to (0.0, 0.0)
.
scale: Vec2<f32>
Expand description
The scale that the graphic should be drawn at. Defaults to (1.0, 1.0)
.
This can be set to a negative value to flip the graphic around the origin.
origin: Vec2<f32>
Expand description
The origin of the graphic. Defaults to (0.0, 0.0)
(the top left).
This offset is applied before scaling, rotation and positioning. For example, if you have a 16x16 image and set the origin to [8.0, 8.0], subsequent transformations will be performed relative to the center of the image.
rotation: f32
Expand description
The rotation of the graphic, in radians. Defaults to 0.0
.
color: Color
Expand description
A color to multiply the graphic by. Defaults to Color::WHITE
.
Implementations
impl DrawParams
[src]
impl DrawParams
[src]pub fn new() -> DrawParams
[src]
pub fn new() -> DrawParams
[src]Creates a new set of DrawParams
.
pub fn position(self, position: Vec2<f32>) -> DrawParams
[src]
pub fn position(self, position: Vec2<f32>) -> DrawParams
[src]Sets the position that the graphic should be drawn at.
pub fn scale(self, scale: Vec2<f32>) -> DrawParams
[src]
pub fn scale(self, scale: Vec2<f32>) -> DrawParams
[src]Sets the scale that the graphic should be drawn at.
pub fn origin(self, origin: Vec2<f32>) -> DrawParams
[src]
pub fn origin(self, origin: Vec2<f32>) -> DrawParams
[src]Sets the origin of the graphic.
pub fn rotation(self, rotation: f32) -> DrawParams
[src]
pub fn rotation(self, rotation: f32) -> DrawParams
[src]Sets the rotation of the graphic, in radians.
pub fn color(self, color: Color) -> DrawParams
[src]
pub fn color(self, color: Color) -> DrawParams
[src]Sets the color to multiply the graphic by.
Trait Implementations
impl Clone for DrawParams
[src]
impl Clone for DrawParams
[src]fn clone(&self) -> DrawParams
[src]
fn clone(&self) -> DrawParams
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for DrawParams
[src]
impl Debug for DrawParams
[src]impl Default for DrawParams
[src]
impl Default for DrawParams
[src]fn default() -> DrawParams
[src]
fn default() -> DrawParams
[src]Returns the “default value” for a type. Read more
impl From<Vec2<f32>> for DrawParams
[src]
impl From<Vec2<f32>> for DrawParams
[src]fn from(position: Vec2<f32>) -> DrawParams
[src]
fn from(position: Vec2<f32>) -> DrawParams
[src]Performs the conversion.
impl PartialEq<DrawParams> for DrawParams
[src]
impl PartialEq<DrawParams> for DrawParams
[src]fn eq(&self, other: &DrawParams) -> bool
[src]
fn eq(&self, other: &DrawParams) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &DrawParams) -> bool
[src]
fn ne(&self, other: &DrawParams) -> bool
[src]This method tests for !=
.
impl StructuralPartialEq for DrawParams
[src]
Auto Trait Implementations
impl RefUnwindSafe for DrawParams
impl Send for DrawParams
impl Sync for DrawParams
impl Unpin for DrawParams
impl UnwindSafe for DrawParams
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more