Struct gfx_graphics::GfxGraphics
source · pub struct GfxGraphics<'a, R, C>where
R: Resources + 'a,
C: CommandBuffer<R> + 'a,
R::Buffer: 'a,
R::Shader: 'a,
R::Program: 'a,
R::Texture: 'a,
R::Sampler: 'a,{
pub encoder: &'a mut Encoder<R, C>,
/* private fields */
}
Expand description
Used for rendering 2D graphics.
Fields§
§encoder: &'a mut Encoder<R, C>
Provide access to the gfx::Encoder
in case a user needs to update textures for caching,
etc.
Implementations§
source§impl<'a, R, C> GfxGraphics<'a, R, C>where
R: Resources,
C: CommandBuffer<R>,
impl<'a, R, C> GfxGraphics<'a, R, C>where
R: Resources,
C: CommandBuffer<R>,
sourcepub fn new(
encoder: &'a mut Encoder<R, C>,
output_color: &'a RenderTargetView<R, Srgba8>,
output_stencil: &'a DepthStencilView<R, DepthStencil>,
g2d: &'a mut Gfx2d<R>
) -> Self
pub fn new( encoder: &'a mut Encoder<R, C>, output_color: &'a RenderTargetView<R, Srgba8>, output_stencil: &'a DepthStencilView<R, DepthStencil>, g2d: &'a mut Gfx2d<R> ) -> Self
Creates a new object for rendering 2D graphics.
sourcepub fn has_texture_alpha(&self, texture: &Texture<R>) -> boolwhere
R: Resources,
pub fn has_texture_alpha(&self, texture: &Texture<R>) -> boolwhere
R: Resources,
Returns true if texture has alpha channel.
Trait Implementations§
source§impl<'a, R, C> Graphics for GfxGraphics<'a, R, C>
impl<'a, R, C> Graphics for GfxGraphics<'a, R, C>
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: &<Self as Graphics>::Texture,
f: F
)
fn tri_list_uv<F>( &mut self, draw_state: &DrawState, color: &[f32; 4], texture: &<Self as Graphics>::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: &<Self as Graphics>::Texture,
f: F
)
fn tri_list_uv_c<F>( &mut self, draw_state: &DrawState, texture: &<Self as Graphics>::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, R, C> Freeze for GfxGraphics<'a, R, C>
impl<'a, R, C> !RefUnwindSafe for GfxGraphics<'a, R, C>
impl<'a, R, C> Send for GfxGraphics<'a, R, C>
impl<'a, R, C> Sync for GfxGraphics<'a, R, C>where
C: Sync,
impl<'a, R, C> Unpin for GfxGraphics<'a, R, C>
impl<'a, R, C> !UnwindSafe for GfxGraphics<'a, R, C>
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