2020-08-29 17:17:56 +00:00
|
|
|
#![cfg_attr(target_os = "none", no_std)]
|
|
|
|
|
|
|
|
|
|
pub mod api;
|
|
|
|
|
pub use api::{Point, Color};
|
|
|
|
|
|
2020-08-30 09:40:29 +00:00
|
|
|
use xous::{try_send_message, CID};
|
2020-08-29 17:17:56 +00:00
|
|
|
|
|
|
|
|
pub fn draw_line(cid: CID, start: Point, end: Point) -> Result<(), xous::Error> {
|
2020-09-23 02:58:09 +00:00
|
|
|
try_send_message(cid, api::Opcode::Line(start, end).into()).map(|_| ())
|
2020-08-29 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn draw_circle(cid: CID, center: Point, radius: u32) -> Result<(), xous::Error> {
|
2020-09-23 02:58:09 +00:00
|
|
|
try_send_message(cid, api::Opcode::Circle(center, radius).into()).map(|_| ())
|
2020-08-29 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn draw_rectangle(cid: CID, start: Point, end: Point) -> Result<(), xous::Error> {
|
2020-09-23 02:58:09 +00:00
|
|
|
try_send_message(cid, api::Opcode::Rectangle(start, end).into()).map(|_| ())
|
2020-08-29 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn set_style(cid: CID, width: u32, stroke: Color, fill: Color) -> Result<(), xous::Error> {
|
2020-09-23 02:58:09 +00:00
|
|
|
try_send_message(cid, api::Opcode::Style(width, stroke, fill).into()).map(|_| ())
|
2020-08-29 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn flush(cid: CID) -> Result<(), xous::Error> {
|
2020-09-23 02:58:09 +00:00
|
|
|
try_send_message(cid, api::Opcode::Flush.into()).map(|_| ())
|
2020-08-29 17:17:56 +00:00
|
|
|
}
|