Struct opengl_graphics::Texture
source · 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