pub trait RenderBackend {
fn draw_rect(
&mut self,
xy: Point,
size: Point,
look: &StyleAttr,
clip: Option<ClipHandle>
);
fn draw_line(&mut self, start: Point, stop: Point, look: &StyleAttr);
fn draw_circle(&mut self, xy: Point, size: Point, look: &StyleAttr);
fn draw_text(&mut self, xy: Point, text: &str, look: &StyleAttr);
fn draw_arrow(
&mut self,
path: &[(Point, Point)],
dashed: bool,
head: (bool, bool),
look: &StyleAttr,
text: &str
);
fn create_clip(
&mut self,
xy: Point,
size: Point,
rounded_px: usize
) -> ClipHandle;
}
Expand description
This is the trait that all rendering backends need to implement.
Required Methods
sourcefn draw_rect(
&mut self,
xy: Point,
size: Point,
look: &StyleAttr,
clip: Option<ClipHandle>
)
fn draw_rect(
&mut self,
xy: Point,
size: Point,
look: &StyleAttr,
clip: Option<ClipHandle>
)
Draw a rectangle. The top-left point of the rectangle is \p xy. The shape style (color, edge-width) are passed in \p look. The parameter \p clip is an optional clip region (see: create_clip).
sourcefn draw_line(&mut self, start: Point, stop: Point, look: &StyleAttr)
fn draw_line(&mut self, start: Point, stop: Point, look: &StyleAttr)
Draw a line between \p start and \p stop.
sourcefn draw_circle(&mut self, xy: Point, size: Point, look: &StyleAttr)
fn draw_circle(&mut self, xy: Point, size: Point, look: &StyleAttr)
Draw an ellipse with the center \p xy, and size \p size.
sourcefn draw_arrow(
&mut self,
path: &[(Point, Point)],
dashed: bool,
head: (bool, bool),
look: &StyleAttr,
text: &str
)
fn draw_arrow(
&mut self,
path: &[(Point, Point)],
dashed: bool,
head: (bool, bool),
look: &StyleAttr,
text: &str
)
Draw an arrow, with a label, with the style parameters in \p look.
sourcefn create_clip(&mut self, xy: Point, size: Point, rounded_px: usize) -> ClipHandle
fn create_clip(&mut self, xy: Point, size: Point, rounded_px: usize) -> ClipHandle
Generate a clip region that shapes can use to create complex shapes.