[][src]Trait leafrender::render::Drawer

pub trait Drawer {
    type NativeTexture: Sized + Dimensions;
    fn start(&mut self);
fn end(&mut self);
fn clear(&mut self, transparent: bool);
fn enable_blending(&mut self);
fn convert_image(&mut self, texture: &RgbaImage) -> Self::NativeTexture;
fn convert_native_texture(
        &mut self,
        texture: Texture
    ) -> Self::NativeTexture;
fn get_width(&self) -> usize;
fn get_height(&self) -> usize;
fn set_background(&mut self, image: DynamicImage);
fn set_brightness(&mut self, brightness: u8) -> Result<()>;
fn draw_textured_vertices_colored_uv(
        &mut self,
        texture: &Self::NativeTexture,
        vertices: &[f32],
        colors: &[f32],
        uv: &[f32]
    );
fn draw_colored_vertices(&mut self, vertices: &[f32], colors: &[f32]);
fn get_transition_count(&self) -> usize;
fn new(title: &str, width: u32, height: u32) -> Result<Self, String>
    where
        Self: Sized
; fn draw_textured_vertices_colored(
        &mut self,
        texture: &Self::NativeTexture,
        vertices: &[f32],
        colors: &[f32]
    ) { ... }
fn draw_textured_vertices(
        &mut self,
        texture: &Self::NativeTexture,
        vertices: &[f32]
    ) { ... }
fn draw_texture_sized(
        &mut self,
        texture: &Self::NativeTexture,
        rect: &Rect,
        color: &Color
    ) { ... }
fn draw_texture_colored(
        &mut self,
        texture: &Self::NativeTexture,
        pos: &Position,
        color: &Color
    ) { ... }
fn draw_texture(&mut self, texture: &Self::NativeTexture, pos: &Position) { ... }
fn draw_colored_rect(&mut self, rect: &Rect, color: &Color) { ... }
fn rect_to_vertices(&self, rect: &Rect) -> [f32; 12] { ... } }

Structures for rendering stuff to the screen

Associated Types

Loading content...

Required methods

fn start(&mut self)

Starts a particular rendering frame

fn end(&mut self)

Ends a frame, requesting for framebuffers to be finalised/etc

fn clear(&mut self, transparent: bool)

Clears the frame. transparent: If the frame should be cleared to alpha 0.

fn enable_blending(&mut self)

Enables blending of a texture/etc with the background, if this is explicitly required.

fn convert_image(&mut self, texture: &RgbaImage) -> Self::NativeTexture

Converts an RGBA image to a native image.

fn convert_native_texture(&mut self, texture: Texture) -> Self::NativeTexture

Converts a texture to a native reference.

fn get_width(&self) -> usize

Returns the width of the framebuffer.

fn get_height(&self) -> usize

Returns the height of the framebuffer.

fn set_background(&mut self, image: DynamicImage)

Uses the specified image as a background. This is provided as several platforms have ways to accelerate this beyond OpenGL calls.

fn set_brightness(&mut self, brightness: u8) -> Result<()>

Sets the screen brightness, if possible. Ignore call if not.

fn draw_textured_vertices_colored_uv(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32],
    colors: &[f32],
    uv: &[f32]
)

Draws a texture to the screen, with a specified set of vertices to draw to, a UV to decode the image with, and a color to use as a base.

fn draw_colored_vertices(&mut self, vertices: &[f32], colors: &[f32])

Draws a set of colored vertices to the screen, with a specified color array.

fn get_transition_count(&self) -> usize

Returns the count of transitions that occured so far in this frame.

fn new(title: &str, width: u32, height: u32) -> Result<Self, String> where
    Self: Sized

Creates a new instance of this drawer.

All parameters are handled only if the target platform handles them.

Loading content...

Provided methods

fn draw_textured_vertices_colored(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32],
    colors: &[f32]
)

Draws a texture to the screen, with a specified set of vertices to draw to, and a color to use as a base.

fn draw_textured_vertices(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32]
)

Draws a texture to the screen, with a specified set of vertices to draw to, and a default UV.

fn draw_texture_sized(
    &mut self,
    texture: &Self::NativeTexture,
    rect: &Rect,
    color: &Color
)

Draws a texture to the screen, with the specified x/y coordinates (relative to screen size), and a specified width/height.

fn draw_texture_colored(
    &mut self,
    texture: &Self::NativeTexture,
    pos: &Position,
    color: &Color
)

Draws a texture to the screen, with the specified x/y coordinates (relative to screen size), and the texture dimensions as width/height.

fn draw_texture(&mut self, texture: &Self::NativeTexture, pos: &Position)

Draws a texture to the screen, with the specified x/y coordinates (relative to screen size), and the texture dimensions as width/height.

fn draw_colored_rect(&mut self, rect: &Rect, color: &Color)

Draws a colored rectangle to the screen, with a single color.

fn rect_to_vertices(&self, rect: &Rect) -> [f32; 12]

Converts a rectangle to 4 vertices

Loading content...

Implementors

impl Drawer for GlutinDrawer[src]

type NativeTexture = GlTexture

fn end(&mut self)[src]

Ends this frame.

fn clear(&mut self, transparent: bool)[src]

Clears the framebuffer.

fn enable_blending(&mut self)[src]

Enables blending of alpha textures. Disabled at end of frame.

fn get_width(&self) -> usize[src]

Returns the width of the screen.

fn get_height(&self) -> usize[src]

Returns the height of the screen.

fn set_background(&mut self, image: DynamicImage)[src]

Uses the specified image as a background. This is provided as several platforms have ways to accelerate this beyond OpenGL calls.

fn set_brightness(&mut self, _val: u8) -> Result<()>[src]

Sets the brightness of the screen.

fn draw_textured_vertices_colored_uv(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32],
    colors: &[f32],
    uv: &[f32]
)
[src]

Draws a texture to the screen, with a specified set of vertices to draw to, a UV to decode the image with, and a color to use as a base.

fn draw_colored_vertices(&mut self, vertices: &[f32], colors: &[f32])[src]

Draws a set of colored vertices to the screen, with a specified color array.

fn draw_textured_vertices_colored(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32],
    colors: &[f32]
)
[src]

fn draw_textured_vertices(
    &mut self,
    texture: &Self::NativeTexture,
    vertices: &[f32]
)
[src]

fn draw_texture_sized(
    &mut self,
    texture: &Self::NativeTexture,
    rect: &Rect,
    color: &Color
)
[src]

fn draw_texture_colored(
    &mut self,
    texture: &Self::NativeTexture,
    pos: &Position,
    color: &Color
)
[src]

fn draw_texture(&mut self, texture: &Self::NativeTexture, pos: &Position)[src]

fn draw_colored_rect(&mut self, rect: &Rect, color: &Color)[src]

fn rect_to_vertices(&self, rect: &Rect) -> [f32; 12][src]

Loading content...