[][src]Trait crow::DrawTarget

pub trait DrawTarget {
    fn receive_draw(
        &mut self,
        ctx: &mut Context,
        texture: &Texture,
        position: (i32, i32),
        config: &DrawConfig
    ) -> Result<(), ErrDontCare>;
fn receive_clear_color(
        &mut self,
        ctx: &mut Context,
        color: (f32, f32, f32, f32)
    ) -> Result<(), ErrDontCare>;
fn receive_line(
        &mut self,
        ctx: &mut Context,
        from: (i32, i32),
        to: (i32, i32),
        color: (f32, f32, f32, f32)
    ) -> Result<(), ErrDontCare>;
fn receive_rectangle(
        &mut self,
        ctx: &mut Context,
        lower_left: (i32, i32),
        upper_right: (i32, i32),
        color: (f32, f32, f32, f32)
    ) -> Result<(), ErrDontCare>; }

A trait implemented by types upon which can be drawn.

It is recommended to use the corresponding methods of Context instead of calling the methods of this trait directly.

Required methods

fn receive_draw(
    &mut self,
    ctx: &mut Context,
    texture: &Texture,
    position: (i32, i32),
    config: &DrawConfig
) -> Result<(), ErrDontCare>

Draws the texture onto self.

fn receive_clear_color(
    &mut self,
    ctx: &mut Context,
    color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>

Sets each pixel of self to color.

fn receive_line(
    &mut self,
    ctx: &mut Context,
    from: (i32, i32),
    to: (i32, i32),
    color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>

Draws a line from from to to.

fn receive_rectangle(
    &mut self,
    ctx: &mut Context,
    lower_left: (i32, i32),
    upper_right: (i32, i32),
    color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>

Draws the bounding box of an axis-aligned rectangle specified by its lower_left and upper_right corner.

In case lower_left is to the right or above upper_right, the two points will be flipped.

Loading content...

Implementations on Foreign Types

impl<'_, T: DrawTarget> DrawTarget for &'_ mut T[src]

Loading content...

Implementors

impl DrawTarget for Texture[src]

fn receive_draw(
    &mut self,
    ctx: &mut Context,
    texture: &Texture,
    position: (i32, i32),
    config: &DrawConfig
) -> Result<(), ErrDontCare>
[src]

Draws the texture onto self. This permanently alters self, in case the original is still required, consider cloning this Texture first.

It is recommended to call Context::draw instead of using this method directly.

impl DrawTarget for WindowSurface[src]

fn receive_draw(
    &mut self,
    ctx: &mut Context,
    texture: &Texture,
    position: (i32, i32),
    config: &DrawConfig
) -> Result<(), ErrDontCare>
[src]

Draws texture to the window, to finish the frame, call Context::finalize_frame.

impl<T: DrawTarget> DrawTarget for Offset<T>[src]

impl<T: DrawTarget> DrawTarget for Scaled<T>[src]

Loading content...