Trait graphics::Graphics
[−]
[src]
pub trait Graphics: Sized { type Texture: ImageSize; fn clear_color(&mut self, color: [f32; 4]); fn clear_stencil(&mut self, value: u8); fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F) where F: FnMut(&mut FnMut(&[f32])); fn tri_list_uv<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], texture: &Self::Texture, f: F) where F: FnMut(&mut FnMut(&[f32], &[f32])); fn rectangle<R: Into<Rectangle>>(&mut self, r: &Rectangle, rectangle: R, draw_state: &DrawState, transform: Matrix2d) { ... } fn polygon(&mut self, p: &Polygon, polygon: Polygon, draw_state: &DrawState, transform: Matrix2d) { ... } fn polygon_tween_lerp(&mut self, p: &Polygon, polygons: Polygons, tween_factor: Scalar, draw_state: &DrawState, transform: Matrix2d) { ... } fn image(&mut self, image: &Image, texture: &Self::Texture, draw_state: &DrawState, transform: Matrix2d) { ... } fn ellipse<R: Into<Rectangle>>(&mut self, e: &Ellipse, rectangle: R, draw_state: &DrawState, transform: Matrix2d) { ... } fn line<L: Into<Line>>(&mut self, l: &Line, line: L, draw_state: &DrawState, transform: Matrix2d) { ... } fn circle_arc<R: Into<Rectangle>>(&mut self, c: &CircleArc, rectangle: R, draw_state: &DrawState, transform: Matrix2d) { ... } fn deform_image(&mut self, d: &DeformGrid, texture: &Self::Texture, draw_state: &DrawState, transform: Matrix2d) { ... } }
Implemented by all graphics back-ends.
Associated Types
type Texture: ImageSize
The texture type associated with the back-end.
Required Methods
fn clear_color(&mut self, color: [f32; 4])
Clears background with a color.
fn clear_stencil(&mut self, value: u8)
Clears stencil buffer with a value.
fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F) where F: FnMut(&mut FnMut(&[f32]))
Renders list of 2d triangles.
fn tri_list_uv<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], texture: &Self::Texture, f: F) where F: FnMut(&mut FnMut(&[f32], &[f32]))
Renders list of 2d triangles.
A texture coordinate is assigned per vertex. The texture coordinates refers to the current texture.
Provided Methods
fn rectangle<R: Into<Rectangle>>(&mut self, r: &Rectangle, rectangle: R, draw_state: &DrawState, transform: Matrix2d)
Draws a rectangle.
fn polygon(&mut self, p: &Polygon, polygon: Polygon, draw_state: &DrawState, transform: Matrix2d)
Draws a polygon.
fn polygon_tween_lerp(&mut self, p: &Polygon, polygons: Polygons, tween_factor: Scalar, draw_state: &DrawState, transform: Matrix2d)
Draws a tweened polygon using linear interpolation.
fn image(&mut self, image: &Image, texture: &Self::Texture, draw_state: &DrawState, transform: Matrix2d)
Draws image.
fn ellipse<R: Into<Rectangle>>(&mut self, e: &Ellipse, rectangle: R, draw_state: &DrawState, transform: Matrix2d)
Draws ellipse.
fn line<L: Into<Line>>(&mut self, l: &Line, line: L, draw_state: &DrawState, transform: Matrix2d)
Draws line.
fn circle_arc<R: Into<Rectangle>>(&mut self, c: &CircleArc, rectangle: R, draw_state: &DrawState, transform: Matrix2d)
Draws circle arc.
fn deform_image(&mut self, d: &DeformGrid, texture: &Self::Texture, draw_state: &DrawState, transform: Matrix2d)
Draws deformed image.