pub trait DrawFromOrigin<I> {
    // Required method
    fn draw_from_origin_with_flip(
        &self,
        image: &I,
        position: impl Into<[i32; 2]>,
        origin: impl Into<[f32; 2]>,
        flip: impl Into<[bool; 2]>
    );

    // Provided method
    fn draw_from_origin(
        &self,
        image: &I,
        position: impl Into<[i32; 2]>,
        origin: impl Into<[f32; 2]>
    ) { ... }
}
Expand description

Ability to draw an image from its origin point (instead of from the top-left)

This trait is automatically implemented for implementations of DrawImage<I> where I: HasSize

Required Methods§

source

fn draw_from_origin_with_flip( &self, image: &I, position: impl Into<[i32; 2]>, origin: impl Into<[f32; 2]>, flip: impl Into<[bool; 2]> )

Draw the image so that the origin is at position with given flip argument.

The origin is expressed in ratio of the size. So [0., 0.] is the top-left and [1.,1.] is the bottom right.

If flipped, the image is fliped around its origin.

Provided Methods§

source

fn draw_from_origin( &self, image: &I, position: impl Into<[i32; 2]>, origin: impl Into<[f32; 2]> )

Draw the image so that the origin is at position

The origin is expressed in ratio of the size. So [0., 0.] is the top-left and [1.,1.] is the bottom right.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, I> DrawFromOrigin<I> for T
where T: DrawImage<I>, I: HasSize,