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>,

source

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.

source

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>where R: Resources, C: CommandBuffer<R>, R::Buffer: 'a, R::Shader: 'a, R::Program: 'a, R::Texture: 'a, R::Sampler: 'a,

§

type Texture = Texture<R>

The texture type associated with the back-end. Read more
source§

fn clear_color(&mut self, color: [f32; 4])

Clears background with a color. Read more
source§

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)where F: FnMut(&mut dyn FnMut(&[[f32; 2]])),

Renders list of 2d triangles using a solid color. Read more
source§

fn tri_list_c<F>(&mut self, draw_state: &DrawState, f: F)where F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 4]])),

Same as tri_list, but with individual vertex colors. Read more
source§

fn tri_list_uv<F>( &mut self, draw_state: &DrawState, color: &[f32; 4], texture: &<Self as Graphics>::Texture, f: F )where F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 2]])),

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 )where F: FnMut(&mut dyn FnMut(&[[f32; 2]], &[[f32; 2]], &[[f32; 4]])),

Same as tri_list_uv, but with individual vertex colors. Read more
source§

fn rectangle<R>( &mut self, r: &Rectangle, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2] )where R: Into<[f64; 4]>,

Draws a rectangle. Read more
source§

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] )

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] )

Draws image. Read more
source§

fn ellipse<R>( &mut self, e: &Ellipse, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2] )where R: Into<[f64; 4]>,

Draws ellipse. Read more
source§

fn line<L>( &mut self, l: &Line, line: L, draw_state: &DrawState, transform: [[f64; 3]; 2] )where L: Into<[f64; 4]>,

Draws line. Read more
source§

fn circle_arc<R>( &mut self, c: &CircleArc, rectangle: R, draw_state: &DrawState, transform: [[f64; 3]; 2] )where R: Into<[f64; 4]>,

Draws circle arc. Read more

Auto Trait Implementations§

§

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> 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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
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.
source§

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

Performs the conversion.