pub struct Texture {
pub data: Vec<u32>,
pub width: u32,
pub height: u32,
pub mip_levels: u32,
}Fields§
§data: Vec<u32>§width: u32§height: u32§mip_levels: u32Implementations§
Source§impl Texture
impl Texture
pub const MIP_LEVELS: usize = 5
pub fn generate_mipmaps(&mut self, levels: usize)
pub fn texel_count(width: u32, height: u32, levels: usize) -> usize
pub fn sample_uv_rgba(&self, uv: [f32; 2]) -> [f32; 4]
pub fn sample_uv_bgra(&self, uv: [f32; 2]) -> [f32; 4]
pub fn sample_uv_rgb(&self, uv: [f32; 2]) -> [f32; 3]
pub fn sample_uv_bgr(&self, uv: [f32; 2]) -> [f32; 3]
pub fn get_texel(&self, x: usize, y: usize) -> u32
pub fn is_empty(&self) -> bool
pub fn offset_for_level(&self, mip_level: usize) -> usize
pub fn mip_level_width(&self, mip_level: usize) -> usize
pub fn mip_level_height(&self, mip_level: usize) -> usize
pub fn mip_level_width_height(&self, mip_level: usize) -> (usize, usize)
Sourcepub fn resized(&self, width: u32, height: u32) -> Texture
pub fn resized(&self, width: u32, height: u32) -> Texture
Resizes texture into given dimensions, this is an expensive operation.
pub fn load<T: AsRef<Path>>(path: T, flip: Flip) -> Result<Self, LoadError>
pub fn flipped(&mut self, flip: Flip) -> Self
pub fn merge( r: Option<&Self>, g: Option<&Self>, b: Option<&Self>, a: Option<&Self>, ) -> Self
Sourcepub fn from_bytes(
bytes: &[u8],
width: u32,
height: u32,
format: TextureFormat,
stride: usize,
) -> Self
pub fn from_bytes( bytes: &[u8], width: u32, height: u32, format: TextureFormat, stride: usize, ) -> Self
Parses texture from bytes. Stride is size of texel in bytes
pub fn transformed<C>(self, cb: C) -> Texture
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
impl UnwindSafe for Texture
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more