pub struct TextureData {
pub width: u32,
pub height: u32,
pub pixels: Vec<u8>,
pub is_animated: bool,
pub frame_count: u32,
}Expand description
Raw texture data loaded from PNG.
Fields§
§width: u32Texture width in pixels.
height: u32Texture height in pixels.
pixels: Vec<u8>RGBA8 pixel data (4 bytes per pixel).
is_animated: boolWhether this texture has animation metadata.
frame_count: u32Animation frame count (1 if not animated).
Implementations§
Source§impl TextureData
impl TextureData
Sourcepub fn new(width: u32, height: u32, pixels: Vec<u8>) -> Self
pub fn new(width: u32, height: u32, pixels: Vec<u8>) -> Self
Create a new texture from RGBA data.
Sourcepub fn placeholder() -> Self
pub fn placeholder() -> Self
Create a placeholder texture (magenta/black checkerboard).
Sourcepub fn has_transparency(&self) -> bool
pub fn has_transparency(&self) -> bool
Check if this texture has transparency.
Sourcepub fn first_frame(&self) -> TextureData
pub fn first_frame(&self) -> TextureData
Get the first frame of an animated texture (or the whole texture if not animated).
Trait Implementations§
Source§impl Clone for TextureData
impl Clone for TextureData
Source§fn clone(&self) -> TextureData
fn clone(&self) -> TextureData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TextureData
impl RefUnwindSafe for TextureData
impl Send for TextureData
impl Sync for TextureData
impl Unpin for TextureData
impl UnwindSafe for TextureData
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