pub struct Texture { /* private fields */ }Expand description
Wraps OpenGL texture data. The texture gets deleted when running out of scope.
In order to create a texture the function GenTextures must be loaded.
This is done automatically by the window back-ends in Piston.
Implementations§
Source§impl Texture
impl Texture
Sourcepub fn empty(settings: &TextureSettings) -> Result<Self, String>
pub fn empty(settings: &TextureSettings) -> Result<Self, String>
Returns empty texture.
Sourcepub fn from_memory_alpha(
buf: &[u8],
width: u32,
height: u32,
settings: &TextureSettings,
) -> Result<Self, String>
pub fn from_memory_alpha( buf: &[u8], width: u32, height: u32, settings: &TextureSettings, ) -> Result<Self, String>
Loads image from memory, the format is 8-bit greyscale.
Sourcepub fn from_path<P>(path: P, settings: &TextureSettings) -> Result<Self, String>
pub fn from_path<P>(path: P, settings: &TextureSettings) -> Result<Self, String>
Loads image by relative file name to the asset root.
Sourcepub fn from_bytes(
bytes: &[u8],
settings: &TextureSettings,
) -> Result<Self, String>
pub fn from_bytes( bytes: &[u8], settings: &TextureSettings, ) -> Result<Self, String>
Load image from bytes.
Sourcepub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self
pub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self
Creates a texture from image.
Trait Implementations§
Source§impl CreateTexture<()> for Texture
impl CreateTexture<()> for Texture
Auto Trait Implementations§
impl Freeze for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin 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
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