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>
The position that the graphic should be drawn at. Defaults to (0.0, 0.0)
.
scale: Vec2<f32>
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>
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
The rotation of the graphic, in radians. Defaults to 0.0
.
color: Color
A color to multiply the graphic by. Defaults to Color::WHITE
.
Implementations§
Source§impl DrawParams
impl DrawParams
Sourcepub fn new() -> DrawParams
pub fn new() -> DrawParams
Creates a new set of DrawParams
.
Sourcepub fn position(self, position: Vec2<f32>) -> DrawParams
pub fn position(self, position: Vec2<f32>) -> DrawParams
Sets the position that the graphic should be drawn at.
Sourcepub fn scale(self, scale: Vec2<f32>) -> DrawParams
pub fn scale(self, scale: Vec2<f32>) -> DrawParams
Sets the scale that the graphic should be drawn at.
Sourcepub fn origin(self, origin: Vec2<f32>) -> DrawParams
pub fn origin(self, origin: Vec2<f32>) -> DrawParams
Sets the origin of the graphic.
Sourcepub fn rotation(self, rotation: f32) -> DrawParams
pub fn rotation(self, rotation: f32) -> DrawParams
Sets the rotation of the graphic, in radians.
Sourcepub fn color(self, color: Color) -> DrawParams
pub fn color(self, color: Color) -> DrawParams
Sets the color to multiply the graphic by.
Trait Implementations§
Source§impl Clone for DrawParams
impl Clone for DrawParams
Source§fn clone(&self) -> DrawParams
fn clone(&self) -> DrawParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DrawParams
impl Debug for DrawParams
Source§impl Default for DrawParams
impl Default for DrawParams
Source§fn default() -> DrawParams
fn default() -> DrawParams
Source§impl From<DrawParams> for Mat4<f32>
impl From<DrawParams> for Mat4<f32>
Source§fn from(params: DrawParams) -> Self
fn from(params: DrawParams) -> Self
Source§impl PartialEq for DrawParams
impl PartialEq for DrawParams
impl StructuralPartialEq for DrawParams
Auto Trait Implementations§
impl Freeze for DrawParams
impl RefUnwindSafe for DrawParams
impl Send for DrawParams
impl Sync for DrawParams
impl Unpin for DrawParams
impl UnwindSafe for DrawParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more