pub struct WgpuGraphics<'a> { /* private fields */ }
Expand description
Graphics back-end.
Implementations§
Source§impl<'a> WgpuGraphics<'a>
impl<'a> WgpuGraphics<'a>
Sourcepub fn new(wgpu2d: &'a Wgpu2d<'a>, config: &SurfaceConfiguration) -> Self
pub fn new(wgpu2d: &'a Wgpu2d<'a>, config: &SurfaceConfiguration) -> Self
Creates a new WgpuGraphics
.
Sourcepub fn draw(self, device: &Device, output_view: &TextureView) -> CommandBuffer
pub fn draw(self, device: &Device, output_view: &TextureView) -> CommandBuffer
Performs 2D graphics operations and returns encoded commands.
To actually draw on a window surface, you must submit
the returned CommandBuffer
.
Trait Implementations§
Source§impl<'a> Graphics for WgpuGraphics<'a>
impl<'a> Graphics for WgpuGraphics<'a>
Source§fn clear_color(&mut self, color: Color)
fn clear_color(&mut self, color: Color)
Clears background with a color. Read more
Source§fn clear_stencil(&mut self, value: u8)
fn clear_stencil(&mut self, value: u8)
Clears stencil buffer with a value, usually 0. Read more
Source§fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
Renders list of 2d triangles using a solid color. Read more
Source§fn tri_list_c<F>(&mut self, draw_state: &DrawState, f: F)
fn tri_list_c<F>(&mut self, draw_state: &DrawState, f: F)
Same as
tri_list
, but with individual vertex colors. Read moreSource§fn tri_list_uv<F>(
&mut self,
draw_state: &DrawState,
color: &[f32; 4],
texture: &Texture,
f: F,
)
fn tri_list_uv<F>( &mut self, draw_state: &DrawState, color: &[f32; 4], texture: &Texture, f: F, )
Renders list of 2d triangles using a color and a texture. Read more
Source§fn tri_list_uv_c<F>(&mut self, draw_state: &DrawState, texture: &Texture, f: F)
fn tri_list_uv_c<F>(&mut self, draw_state: &DrawState, texture: &Texture, f: F)
Same as
tri_list_uv
, but with individual vertex colors. Read moreSource§fn rectangle<R>(
&mut self,
r: &Rectangle,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn rectangle<R>( &mut self, r: &Rectangle, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2], )
Draws a rectangle. Read more
Source§fn polygon(
&mut self,
p: &Polygon,
polygon: &[[f64; 2]],
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn polygon( &mut self, p: &Polygon, polygon: &[[f64; 2]], draw_state: &DrawState, transform: [[f64; 3]; 2], )
Draws a polygon. Read more
Source§fn polygon_tween_lerp(
&mut self,
p: &Polygon,
polygons: &[&[[f64; 2]]],
tween_factor: f64,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn polygon_tween_lerp( &mut self, p: &Polygon, polygons: &[&[[f64; 2]]], tween_factor: f64, draw_state: &DrawState, transform: [[f64; 3]; 2], )
Draws a tweened polygon using linear interpolation. Read more
Source§fn image(
&mut self,
image: &Image,
texture: &Self::Texture,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn image( &mut self, image: &Image, texture: &Self::Texture, draw_state: &DrawState, transform: [[f64; 3]; 2], )
Draws image. Read more
Source§fn ellipse<R>(
&mut self,
e: &Ellipse,
rectangle: R,
draw_state: &DrawState,
transform: [[f64; 3]; 2],
)
fn ellipse<R>( &mut self, e: &Ellipse, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2], )
Draws ellipse. Read more
Auto Trait Implementations§
impl<'a> Freeze for WgpuGraphics<'a>
impl<'a> !RefUnwindSafe for WgpuGraphics<'a>
impl<'a> Send for WgpuGraphics<'a>
impl<'a> Sync for WgpuGraphics<'a>
impl<'a> Unpin for WgpuGraphics<'a>
impl<'a> !UnwindSafe for WgpuGraphics<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more