[−][src]Struct rustbatch::render::texture::Texture
Texture is wrapper for opengl texture object its just an unsafe pointer with useful methods
Implementations
impl Texture
[src]
pub const NONE: Self
[src]
pub fn default(path: &str) -> Result<Texture, ImageError>
[src]
default creates what i consider default texture from provided path (no interpolation, alfa channel)
pub fn empty_texture(size: TextureSize, config: TextureConfig) -> Self
[src]
empty texture creates texture with all pixels set to 0. its useful mainly for canvas.
pub fn new<P: AsRef<Path>>(
path: P,
config: TextureConfig
) -> Result<Texture, ImageError>
[src]
path: P,
config: TextureConfig
) -> Result<Texture, ImageError>
new creates new texture. for mode you have two options:
- gl::NEAREST - it makes pixels visible
- gl::LINEAR - it linearly interpolates between pixels and generally looks little ugly
pub fn from_img(img: &DynamicImage, config: TextureConfig) -> Texture
[src]
from_img returns texture from provided DynamicImage in case you want to do some pre processing on texture
pub fn from_raw_data(
size: TextureSize,
bytes: *const u8,
config: TextureConfig,
mipmap: bool
) -> Texture
[src]
size: TextureSize,
bytes: *const u8,
config: TextureConfig,
mipmap: bool
) -> Texture
its just lower level function, it may come handy
pub fn resize_and_clear(&mut self, size: TextureSize)
[src]
resize_and_clear si here purely for resizing canvas textures, otherwise not very useful because it also erases the content of a texture.
pub fn to_image<P: Pixel<Subpixel = u8> + 'static>(
&self
) -> Option<ImageBuffer<P, Vec<u8>>>
[src]
&self
) -> Option<ImageBuffer<P, Vec<u8>>>
to image takes texture from gpu memory to back to you so you can save texture
pub fn size(&self) -> Vect
[src]
pub fn frame(&self) -> Rect
[src]
frame returns bounding rectangle of texture useful for sprite
pub fn id(&self) -> GLuint
[src]
id returns texture id. its a pointer to gl texture object
pub fn bind(&self)
[src]
set used uses ah texture
pub fn unbind()
[src]
Trait Implementations
impl Clone for Texture
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for Texture
[src]
Auto Trait Implementations
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnwindSafe for Texture
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>,