[−][src]Struct tetra::graphics::DrawParams
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
.
clip: Option<Rectangle>
A sub-region of the graphic to draw. Defaults to None
, which means the the full graphic will be drawn.
Note that clipped texture regions may 'bleed' when drawing at non-integer co-ordinates. To avoid this, either add one pixel of padding around the images in the texture atlas (preferably matching the color of the actual border), or ensure your drawing is clamped to integer co-ordinates.
Implementations
impl DrawParams
[src]
pub fn new() -> DrawParams
[src]
Creates a new set of DrawParams
.
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]
Sets the scale that the graphic should be drawn at.
pub fn origin(self, origin: Vec2<f32>) -> DrawParams
[src]
Sets the origin of the graphic.
pub fn rotation(self, rotation: f32) -> DrawParams
[src]
Sets the rotation of the graphic, in radians.
pub fn color(self, color: Color) -> DrawParams
[src]
Sets the color to multiply the graphic by.
pub fn clip(self, clip: Rectangle) -> DrawParams
[src]
Sets the region of the graphic to draw.
Trait Implementations
impl Clone for DrawParams
[src]
pub fn clone(&self) -> DrawParams
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DrawParams
[src]
impl Default for DrawParams
[src]
pub fn default() -> DrawParams
[src]
impl From<Vec2<f32>> for DrawParams
[src]
pub fn from(position: Vec2<f32>) -> DrawParams
[src]
impl PartialEq<DrawParams> for DrawParams
[src]
pub fn eq(&self, other: &DrawParams) -> bool
[src]
pub fn ne(&self, other: &DrawParams) -> bool
[src]
impl StructuralPartialEq for DrawParams
[src]
Auto Trait Implementations
impl RefUnwindSafe for DrawParams
[src]
impl Send for DrawParams
[src]
impl Sync for DrawParams
[src]
impl Unpin for DrawParams
[src]
impl UnwindSafe for DrawParams
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,