pub trait SpriteView<'a> {
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn rotate(&'a self, rotation: Rotation) -> SpriteViewImpl<'a>;
fn flip_horizontally(
&'a self,
flip_horizontally: bool,
) -> SpriteViewImpl<'a>;
fn flip_vertically(&'a self, flip_vertically: bool) -> SpriteViewImpl<'a>;
fn clip(
&'a self,
src_x: u32,
src_y: u32,
width: u32,
height: u32,
) -> SpriteViewImpl<'a>;
fn blit(&self, x: i32, y: i32);
}Expand description
A generic view over a sprite or a sprite transformation
Further transformations can be applied to a generic sprite view, or it can be drawn to the screen.
This trait allows to define functions that accept both “original” sprites
(i.e. of type Sprite) or their transformations (e.g. of type
SpriteViewImpl).
Required Methods§
Sourcefn rotate(&'a self, rotation: Rotation) -> SpriteViewImpl<'a>
fn rotate(&'a self, rotation: Rotation) -> SpriteViewImpl<'a>
Apply a rotation to the sprite view
Sourcefn flip_horizontally(&'a self, flip_horizontally: bool) -> SpriteViewImpl<'a>
fn flip_horizontally(&'a self, flip_horizontally: bool) -> SpriteViewImpl<'a>
Flip the sprite view horizontally
Sourcefn flip_vertically(&'a self, flip_vertically: bool) -> SpriteViewImpl<'a>
fn flip_vertically(&'a self, flip_vertically: bool) -> SpriteViewImpl<'a>
Flip the sprite view vertically
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".