[−][src]Struct pix_engine::sprite::Sprite
Methods
impl Sprite
[src]
pub fn new(width: u32, height: u32) -> Self
[src]
Creates a new sprite with given size
pub fn rgb(width: u32, height: u32) -> Self
[src]
pub fn rgba(width: u32, height: u32) -> Self
[src]
pub fn from_bytes(
width: u32,
height: u32,
bytes: &[u8]
) -> PixEngineResult<Self>
[src]
width: u32,
height: u32,
bytes: &[u8]
) -> PixEngineResult<Self>
Creates a new sprite from an array of bytes
pub fn get_pixel(&self, x: u32, y: u32) -> Pixel
[src]
Gets the pixel at the given (x, y) coords
pub fn put_pixel(&mut self, x: u32, y: u32, p: Pixel)
[src]
Sets the pixel at the given (x, y) coords
pub fn color_type(&self) -> ColorType
[src]
ColorType of the sprite
pub fn width(&self) -> u32
[src]
Width of the sprite
pub fn height(&self) -> u32
[src]
Height of the sprite
pub fn bytes(&self) -> &Vec<u8>
[src]
Returns a reference to the pixels within the sprite
pub fn bytes_mut(&mut self) -> &mut Vec<u8>
[src]
Returns a mutable reference to the pixels within the sprite
pub fn from_file(file: &str) -> PixEngineResult<Self>
[src]
Create a new sprite from a PNG file Only 8-bit RGBA formats are supported currently
pub fn save_to_file(&mut self, file: &str) -> PixEngineResult<()>
[src]
Saves a sprite out to a png file
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,