Trait g2d::Texture

source ·
pub trait Texture<H: Handle> {
    // Required methods
    fn handle(&self) -> &H;
    fn wgpu_texture(&self) -> &Texture;

    // Provided methods
    fn wgpu_texture_usage(&self) -> TextureUsages { ... }
    fn size(&self) -> Dimension { ... }
    fn canvas(&self) -> Canvas<'_, H> { ... }
}
Expand description

A G2d texture.

A texture can be any object which has a G2d Handle and a wgpu::Texture.

Required Methods§

source

fn handle(&self) -> &H

Returns the Handle used to create this Texture.

source

fn wgpu_texture(&self) -> &Texture

Returns the wgpu::Texture that this Texture wraps.

Provided Methods§

source

fn wgpu_texture_usage(&self) -> TextureUsages

Returns the usages of this Texture allowed for the GPU. Any operations on this Texture not contained in this set will fail.

source

fn size(&self) -> Dimension

Returns the size of this Texture, in pixels.

source

fn canvas(&self) -> Canvas<'_, H>

Creates a Canvas for drawing to this Texture.

Implementors§

source§

impl<'a, H: Handle> Texture<H> for Canvas<'a, H>

source§

impl<'a, H: Handle> Texture<H> for Frame<'a, H>

source§

impl<'a, H: Handle> Texture<H> for OwnedTexture<'a, H>