Trait crow::DrawTarget [−][src]
pub trait DrawTarget {
fn receive_draw(
&mut self,
ctx: &mut Context,
texture: &Texture,
position: (i32, i32),
config: &DrawConfig
);
fn receive_clear_color(
&mut self,
ctx: &mut Context,
color: (f32, f32, f32, f32)
);
fn receive_clear_depth(&mut self, ctx: &mut Context);
fn receive_line(
&mut self,
ctx: &mut Context,
from: (i32, i32),
to: (i32, i32),
color: (f32, f32, f32, f32)
);
fn receive_rectangle(
&mut self,
ctx: &mut Context,
lower_left: (i32, i32),
upper_right: (i32, i32),
color: (f32, f32, f32, f32)
);
fn get_image_data(&self, ctx: &mut Context) -> RgbaImage;
}
Expand description
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
)
fn receive_draw(
&mut self,
ctx: &mut Context,
texture: &Texture,
position: (i32, i32),
config: &DrawConfig
)
Draws the texture
onto self
.
Sets each pixel of self
to color
.
fn receive_clear_depth(&mut self, ctx: &mut Context)
fn receive_clear_depth(&mut self, ctx: &mut Context)
Resets the depth buffer of self
to 1.0
.
Draws a line from from
to to
.
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.
fn get_image_data(&self, ctx: &mut Context) -> RgbaImage
fn get_image_data(&self, ctx: &mut Context) -> RgbaImage
Returns the current state of the DrawTarget
.
For the window surface, this is a simple screenshot.