Trait libremarkable::framebuffer::FramebufferDraw
source · pub trait FramebufferDraw {
fn draw_image(&mut self, img: &RgbImage, pos: Point2<i32>) -> mxcfb_rect;
fn draw_line(
&mut self,
start: Point2<i32>,
end: Point2<i32>,
width: u32,
v: color
) -> mxcfb_rect;
fn draw_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect;
fn fill_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect;
fn draw_polygon(
&mut self,
_: &[Point2<i32>],
fill: bool,
c: color
) -> mxcfb_rect;
fn draw_bezier(
&mut self,
startpt: Point2<f32>,
ctrlpt: Point2<f32>,
endpt: Point2<f32>,
width: f32,
samples: i32,
v: color
) -> mxcfb_rect;
fn draw_dynamic_bezier(
&mut self,
startpt: (Point2<f32>, f32),
ctrlpt: (Point2<f32>, f32),
endpt: (Point2<f32>, f32),
samples: i32,
v: color
) -> mxcfb_rect;
fn draw_text(
&mut self,
pos: Point2<f32>,
text: &str,
size: f32,
col: color,
dryrun: bool
) -> mxcfb_rect;
fn draw_rect(
&mut self,
pos: Point2<i32>,
size: Vector2<u32>,
border_px: u32,
c: color
);
fn fill_rect(&mut self, pos: Point2<i32>, size: Vector2<u32>, c: color);
fn clear(&mut self);
}
Required Methods§
sourcefn draw_image(&mut self, img: &RgbImage, pos: Point2<i32>) -> mxcfb_rect
fn draw_image(&mut self, img: &RgbImage, pos: Point2<i32>) -> mxcfb_rect
Draws img
at pos
with 1:1 scaling
sourcefn draw_line(
&mut self,
start: Point2<i32>,
end: Point2<i32>,
width: u32,
v: color
) -> mxcfb_rect
fn draw_line(
&mut self,
start: Point2<i32>,
end: Point2<i32>,
width: u32,
v: color
) -> mxcfb_rect
Draws a straight line
sourcefn draw_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect
fn draw_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect
Draws a circle using Bresenham circle algorithm
sourcefn fill_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect
fn fill_circle(&mut self, pos: Point2<i32>, rad: u32, c: color) -> mxcfb_rect
Fills a circle
sourcefn draw_polygon(&mut self, _: &[Point2<i32>], fill: bool, c: color) -> mxcfb_rect
fn draw_polygon(&mut self, _: &[Point2<i32>], fill: bool, c: color) -> mxcfb_rect
Draws a polygon
sourcefn draw_bezier(
&mut self,
startpt: Point2<f32>,
ctrlpt: Point2<f32>,
endpt: Point2<f32>,
width: f32,
samples: i32,
v: color
) -> mxcfb_rect
fn draw_bezier(
&mut self,
startpt: Point2<f32>,
ctrlpt: Point2<f32>,
endpt: Point2<f32>,
width: f32,
samples: i32,
v: color
) -> mxcfb_rect
Draws a bezier curve begining at startpt
, with control point ctrlpt
, ending at endpt
with color
sourcefn draw_dynamic_bezier(
&mut self,
startpt: (Point2<f32>, f32),
ctrlpt: (Point2<f32>, f32),
endpt: (Point2<f32>, f32),
samples: i32,
v: color
) -> mxcfb_rect
fn draw_dynamic_bezier(
&mut self,
startpt: (Point2<f32>, f32),
ctrlpt: (Point2<f32>, f32),
endpt: (Point2<f32>, f32),
samples: i32,
v: color
) -> mxcfb_rect
Draws a bezier curve begining at startpt
, with control point ctrlpt
, ending at endpt
with a width at each point and color color
sourcefn draw_text(
&mut self,
pos: Point2<f32>,
text: &str,
size: f32,
col: color,
dryrun: bool
) -> mxcfb_rect
fn draw_text(
&mut self,
pos: Point2<f32>,
text: &str,
size: f32,
col: color,
dryrun: bool
) -> mxcfb_rect
Draws text
at pos
with color
using scale size
sourcefn draw_rect(
&mut self,
pos: Point2<i32>,
size: Vector2<u32>,
border_px: u32,
c: color
)
fn draw_rect(
&mut self,
pos: Point2<i32>,
size: Vector2<u32>,
border_px: u32,
c: color
)
Draws a 1px border rectangle of size size
at pos
with border_px
border thickness