[][src]Struct crow::Texture

pub struct Texture { /* fields omitted */ }

A two dimensional texture stored in video memory.

Textures are copy-on-write, so cloning a texture is cheap until the clone or the original is modified.

Transparency is supported.

Methods

impl Texture[src]

pub fn new(
    ctx: &mut Context,
    dimensions: (u32, u32)
) -> Result<Self, ErrDontCare>
[src]

Creates a new texture with the given dimensions.

The content of the texture is undefined after its creation.

pub fn from_image(
    ctx: &mut Context,
    image: RgbaImage
) -> Result<Self, ErrDontCare>
[src]

pub fn load<P: AsRef<Path>>(
    ctx: &mut Context,
    path: P
) -> Result<Texture, LoadTextureError>
[src]

Loads a texture from an image located at path.

pub fn get_section(&self, position: (u32, u32), size: (u32, u32)) -> Texture[src]

Returns the part of self specified by position and size as a Texture.

Panics

This function panics if part of the requested section would be outside of the original texture.

pub fn dimensions(&self) -> (u32, u32)[src]

pub fn width(&self) -> u32[src]

pub fn height(&self) -> u32[src]

pub fn get_image_data(&self, ctx: &mut Context) -> RgbaImage[src]

Stores the current state of this Texture in an image. This function is fairly slow and should not be used carelessly.

pub fn clear_depth(&mut self, ctx: &mut Context) -> Result<(), ErrDontCare>[src]

Resets the depth buffer to 1.0 for every pixel.

Trait Implementations

impl Clone for Texture[src]

impl Debug for Texture[src]

impl DrawTarget for Texture[src]

fn receive_draw(
    &mut self,
    ctx: &mut Context,
    texture: &Texture,
    position: (i32, i32),
    config: &DrawConfig
) -> Result<(), ErrDontCare>
[src]

Draws the texture onto self. This permanently alters self, in case the original is still required, consider cloning this Texture first.

It is recommended to call Context::draw instead of using this method directly.

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> SetParameter for T

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.