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>
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
Creates a new set of DrawParams
.
Sets the position that the graphic should be drawn at.
Sets the scale that the graphic should be drawn at.
Sets the origin of the graphic.
Sets the rotation of the graphic, in radians.
Sets the color to multiply the graphic by.
Trait Implementations
Returns the “default value” for a type. Read more
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
Mutably borrows from an owned value. Read more