Struct ggez::graphics::DrawParam
[−]
[src]
pub struct DrawParam { pub src: Rect, pub dest: Point2, pub rotation: f32, pub scale: Point2, pub offset: Point2, pub shear: Point2, pub color: Option<Color>, }
A struct containing all the necessary info for drawing a Drawable.
This struct implements the Default
trait, so to set only some parameter
you can just do:
graphics::draw_ex(ctx, drawable, DrawParam{ dest: my_dest, .. Default::default()} )
Fields
src: Rect
a portion of the drawable to clip, as a fraction of the whole image. Defaults to the whole image (1.0) if omitted.
dest: Point2
the position to draw the graphic expressed as a Point2
.
rotation: f32
orientation of the graphic in radians.
scale: Point2
x/y scale factors expressed as a Point2
.
offset: Point2
specifies an offset from the center for transform operations like scale/rotation,
with 0,0
meaning the origin and 1,1
meaning the opposite corner from the origin.
By default these operations are done from the top-left corner, so to rotate something
from the center specify Point::new(0.5, 0.5)
here.
shear: Point2
x/y shear factors expressed as a Point2
.
color: Option<Color>
A color to draw the target with.
If None
, the color set by graphics::set_color()
is used; default white.
Methods
impl DrawParam
[src]
pub fn into_matrix(self) -> Matrix4
[src]
Turn the DrawParam into a model matrix, combining destination, rotation, scale, offset and shear.
Trait Implementations
impl From<DrawParam> for InstanceProperties
[src]
impl Debug for DrawParam
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Copy for DrawParam
[src]
impl Clone for DrawParam
[src]
fn clone(&self) -> DrawParam
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for DrawParam
[src]
fn eq(&self, __arg_0: &DrawParam) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &DrawParam) -> bool
[src]
This method tests for !=
.