[−][src]Struct olc_pixel_game_engine::Sprite
Mirror of olc::Sprite
.
An image represented by a 2D array of olc::Pixel
.
Implementations
impl Sprite
[src]
pub fn empty() -> Self
[src]
Returns a new empty sprite, alias for Sprite::new
.
This can be used to initialise a sprite instead of using Option
.
pub fn new() -> Self
[src]
Creates a new empty sprite.
pub fn with_dims(width: i32, height: i32) -> Self
[src]
Creates an empty sprite with dimensions width
x height
.
pub fn from_image(path: &str) -> Result<Self, Error>
[src]
Loads a sprite from the image. Returns error if the image could be loaded.
pub fn width(&self) -> i32
[src]
Returns width of the sprite.
pub fn height(&self) -> i32
[src]
Returns height of the sprite.
pub fn has_data(&self) -> bool
[src]
Returns true if sprite has data.
pub fn sample_mode(&self) -> SpriteMode
[src]
Returns sample mode for the sprite.
pub fn set_sample_mode(&mut self, mode: SpriteMode)
[src]
Sets sample mode.
pub fn get_pixel(&self, x: i32, y: i32) -> Pixel
[src]
Returns pixel at (x, y).
pub fn set_pixel(&mut self, x: i32, y: i32, p: Pixel) -> bool
[src]
Sets pixel at (x, y).
pub fn sample(&self, x: f32, y: f32) -> Pixel
[src]
Samples sprite for x
and y
,
x
and y
should be between 0.0 and 1.0.
pub fn sample_bl(&self, u: f32, v: f32) -> Pixel
[src]
Sample BL for u
and v
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Sprite
impl !Send for Sprite
impl !Sync for Sprite
impl Unpin for Sprite
impl UnwindSafe for Sprite
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,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,