Struct imgui_wgpu::Texture

source ·
pub struct Texture { /* private fields */ }
Expand description

A container for a bindable texture.

Implementations§

source§

impl Texture

source

pub fn from_raw_parts( device: &Device, renderer: &Renderer, texture: Arc<Texture>, view: Arc<TextureView>, bind_group: Option<Arc<BindGroup>>, config: Option<&RawTextureConfig<'_>>, size: Extent3d ) -> Self

Create a Texture from its raw parts.

  • bind_group: The bind group used by the texture. If it is None, the bind group will be created like in Self::new.
  • config: The config used for creating the bind group. If bind_group is Some(_), it will be ignored
source

pub fn new( device: &Device, renderer: &Renderer, config: TextureConfig<'_> ) -> Self

Create a new GPU texture width the specified config.

source

pub fn write(&self, queue: &Queue, data: &[u8], width: u32, height: u32)

Write data to the texture.

  • data: 32-bit RGBA bitmap data.
  • width: The width of the source bitmap (data) in pixels.
  • height: The height of the source bitmap (data) in pixels.
source

pub fn width(&self) -> u32

The width of the texture in pixels.

source

pub fn height(&self) -> u32

The height of the texture in pixels.

source

pub fn depth(&self) -> u32

The depth of the texture.

source

pub fn size(&self) -> Extent3d

The size of the texture in pixels.

source

pub fn texture(&self) -> &Texture

The underlying wgpu::Texture.

source

pub fn view(&self) -> &TextureView

The wgpu::TextureView of the underlying texture.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>