[][src]Struct rustbatch::render::texture::Texture

pub struct Texture { /* fields omitted */ }

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]

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]

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]

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,