pub struct DrawParam {
pub src: Rect,
pub color: Color,
pub transform: Transform,
pub z: ZIndex,
}
Expand description
A struct containing all the necessary info for drawing with parameters.
This struct implements the Default
trait, so to set only some parameter
you can just do:
let my_dest = glam::vec2(13.0, 37.0);
canvas.draw(&image, DrawParam::default().dest(my_dest));
As a shortcut, it also implements From
for Into<Point2<f32>>
.
Fields§
§src: Rect
A portion of the drawable to clip, as a fraction of the whole image. Defaults to the whole image ([0.0, 0.0] to [1.0, 1.0]) if omitted.
color: Color
Default: white.
transform: Transform
Where to put the object.
z: ZIndex
The Z coordinate of the draw.
Implementations§
source§impl DrawParam
impl DrawParam
sourcepub fn color(self, color: impl Into<Color>) -> Self
pub fn color(self, color: impl Into<Color>) -> Self
Set the color. This will be blended with whatever color the drawn object already is.
sourcepub fn transform<M>(self, transform: M) -> Selfwhere
M: Into<ColumnMatrix4<f32>>,
pub fn transform<M>(self, transform: M) -> Selfwhere M: Into<ColumnMatrix4<f32>>,
Set the transformation matrix.
Trait Implementations§
source§impl<P> From<P> for DrawParamwhere
P: Into<Point2<f32>>,
impl<P> From<P> for DrawParamwhere P: Into<Point2<f32>>,
Create a DrawParam
from a location, like this:
let my_dest = glam::vec2(13.0, 37.0);
canvas.draw(&image, my_dest);
source§impl PartialEq<DrawParam> for DrawParam
impl PartialEq<DrawParam> for DrawParam
impl Copy for DrawParam
impl StructuralPartialEq for DrawParam
Auto Trait Implementations§
impl RefUnwindSafe for DrawParam
impl Send for DrawParam
impl Sync for DrawParam
impl Unpin for DrawParam
impl UnwindSafe for DrawParam
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
Mutably borrows from an owned value. Read more
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.