Merge pull request #31 from dbr/master
* Update for embedded-graphics 0.5.2 * draw_helper takes IntoIterator * embedded-graphics 0.5.0 removed the with_ prefix from some methods with_stroke() to stroke() with_fill() to fill() with_style() to style() * Update examples to embedded-graphics="0.5.2" alsoembedded-hal-1.0
commit
d452c9744c
|
|
@ -30,7 +30,7 @@ type_a_alternative_faster_lut = []
|
||||||
|
|
||||||
[dependencies.embedded-graphics]
|
[dependencies.embedded-graphics]
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.4.3"
|
version = "0.5.2"
|
||||||
|
|
||||||
[dependencies.embedded-hal]
|
[dependencies.embedded-hal]
|
||||||
features = ["unproven"]
|
features = ["unproven"]
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -23,8 +23,8 @@ let mut display = Display::new(epd.width(), epd.height(), &mut buffer.buffer);
|
||||||
// Draw some text
|
// Draw some text
|
||||||
display.draw(
|
display.draw(
|
||||||
Font12x16::render_str("Hello Rust!")
|
Font12x16::render_str("Hello Rust!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -91,10 +91,3 @@ They are also called A and B, but you shouldn't get confused and mix it with the
|
||||||
| | 7.5in (A) |
|
| | 7.5in (A) |
|
||||||
| | 7.5in (B) |
|
| | 7.5in (B) |
|
||||||
| | 7.5in (C) |
|
| | 7.5in (C) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ edition = "2018"
|
||||||
epd-waveshare = { path = "../../", default-features = false, features = ["epd1in54", "graphics"]}
|
epd-waveshare = { path = "../../", default-features = false, features = ["epd1in54", "graphics"]}
|
||||||
|
|
||||||
linux-embedded-hal = "0.2.2"
|
linux-embedded-hal = "0.2.2"
|
||||||
embedded-graphics = "0.4.5"
|
embedded-graphics = "0.5.2"
|
||||||
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 0!")
|
Font6x8::render_str("Rotate 0!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -89,8 +89,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 90!")
|
Font6x8::render_str("Rotate 90!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -98,8 +98,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 180!")
|
Font6x8::render_str("Rotate 180!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -107,8 +107,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 270!")
|
Font6x8::render_str("Rotate 270!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -129,7 +129,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str(" Hello World! ")
|
Font6x8::render_str(" Hello World! ")
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ edition = "2018"
|
||||||
epd-waveshare = { path = "../../", default-features = false, features = ["epd2in9", "graphics"]}
|
epd-waveshare = { path = "../../", default-features = false, features = ["epd2in9", "graphics"]}
|
||||||
|
|
||||||
linux-embedded-hal = "0.2.2"
|
linux-embedded-hal = "0.2.2"
|
||||||
embedded-graphics = "0.4.5"
|
embedded-graphics = "0.5.2"
|
||||||
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 0!")
|
Font6x8::render_str("Rotate 0!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -93,8 +93,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 90!")
|
Font6x8::render_str("Rotate 90!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -102,8 +102,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 180!")
|
Font6x8::render_str("Rotate 180!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -111,8 +111,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 270!")
|
Font6x8::render_str("Rotate 270!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -133,7 +133,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str(" Hello World! ")
|
Font6x8::render_str(" Hello World! ")
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,5 @@ edition = "2018"
|
||||||
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
||||||
|
|
||||||
linux-embedded-hal = "0.2.2"
|
linux-embedded-hal = "0.2.2"
|
||||||
embedded-graphics = "0.4.5"
|
embedded-graphics = "0.5.2"
|
||||||
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 0!")
|
Font6x8::render_str("Rotate 0!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -84,8 +84,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 90!")
|
Font6x8::render_str("Rotate 90!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -93,8 +93,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 180!")
|
Font6x8::render_str("Rotate 180!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -102,8 +102,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 270!")
|
Font6x8::render_str("Rotate 270!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -120,17 +120,17 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
// draw a analog clock
|
// draw a analog clock
|
||||||
display.draw(
|
display.draw(
|
||||||
Circle::new(Coord::new(64, 64), 64)
|
Circle::new(Coord::new(64, 64), 64)
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("It's working-WoB!")
|
Font6x8::render_str("It's working-WoB!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::Black),
|
fill_color: Some(Color::Black),
|
||||||
stroke_color: Some(Color::White),
|
stroke_color: Some(Color::White),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -151,7 +151,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font12x16::render_str("It's working-BoW!")
|
Font12x16::render_str("It's working-BoW!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -167,7 +167,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str(" Hello World! ")
|
Font6x8::render_str(" Hello World! ")
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ edition = "2018"
|
||||||
#epd_waveshare = { path = "../../"}
|
#epd_waveshare = { path = "../../"}
|
||||||
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
||||||
|
|
||||||
embedded-graphics = "0.4.5"
|
embedded-graphics = "0.5.2"
|
||||||
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
||||||
|
|
||||||
stm32f1xx-hal = { version = "0.2", features = ["rt", "stm32f103" ] }
|
stm32f1xx-hal = { version = "0.2", features = ["rt", "stm32f103" ] }
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ fn main() -> ! {
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 0!")
|
Font6x8::render_str("Rotate 0!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -80,8 +80,8 @@ fn main() -> ! {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 90!")
|
Font6x8::render_str("Rotate 90!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -89,8 +89,8 @@ fn main() -> ! {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 180!")
|
Font6x8::render_str("Rotate 180!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -98,8 +98,8 @@ fn main() -> ! {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 270!")
|
Font6x8::render_str("Rotate 270!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -116,17 +116,17 @@ fn main() -> ! {
|
||||||
// draw a analog clock
|
// draw a analog clock
|
||||||
display.draw(
|
display.draw(
|
||||||
Circle::new(Coord::new(64, 64), 64)
|
Circle::new(Coord::new(64, 64), 64)
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ fn main() -> ! {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("It's working-WoB!")
|
Font6x8::render_str("It's working-WoB!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::Black),
|
fill_color: Some(Color::Black),
|
||||||
stroke_color: Some(Color::White),
|
stroke_color: Some(Color::White),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -147,7 +147,7 @@ fn main() -> ! {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font12x16::render_str("It's working-BoW!")
|
Font12x16::render_str("It's working-BoW!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -165,7 +165,7 @@ fn main() -> ! {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str(" Hello World! ")
|
Font6x8::render_str(" Hello World! ")
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,5 @@ edition = "2018"
|
||||||
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
epd-waveshare = { path = "../../", default-features = false, features = ["epd4in2", "graphics"]}
|
||||||
|
|
||||||
linux-embedded-hal = "0.2.2"
|
linux-embedded-hal = "0.2.2"
|
||||||
embedded-graphics = "0.4.5"
|
embedded-graphics = "0.5.2"
|
||||||
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
embedded-hal = { version = "0.2.2", features = ["unproven"] }
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate0);
|
display.set_rotation(DisplayRotation::Rotate0);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 0!")
|
Font6x8::render_str("Rotate 0!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -88,8 +88,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 90!")
|
Font6x8::render_str("Rotate 90!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -97,8 +97,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 180!")
|
Font6x8::render_str("Rotate 180!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -106,8 +106,8 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("Rotate 270!")
|
Font6x8::render_str("Rotate 270!")
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.with_fill(Some(Color::White))
|
.fill(Some(Color::White))
|
||||||
.translate(Coord::new(5, 50))
|
.translate(Coord::new(5, 50))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
@ -126,17 +126,17 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
// draw a analog clock
|
// draw a analog clock
|
||||||
display.draw(
|
display.draw(
|
||||||
Circle::new(Coord::new(64, 64), 64)
|
Circle::new(Coord::new(64, 64), 64)
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
Line::new(Coord::new(64, 64), Coord::new(0, 64))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
Line::new(Coord::new(64, 64), Coord::new(80, 80))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str("It's working-WoB!")
|
Font6x8::render_str("It's working-WoB!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::Black),
|
fill_color: Some(Color::Black),
|
||||||
stroke_color: Some(Color::White),
|
stroke_color: Some(Color::White),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -157,7 +157,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
display.draw(
|
display.draw(
|
||||||
Font12x16::render_str("It's working-BoW!")
|
Font12x16::render_str("It's working-BoW!")
|
||||||
// Using Style here
|
// Using Style here
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
@ -173,7 +173,7 @@ fn run() -> Result<(), std::io::Error> {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Font6x8::render_str(" Hello World! ")
|
Font6x8::render_str(" Hello World! ")
|
||||||
.with_style(Style {
|
.style(Style {
|
||||||
fill_color: Some(Color::White),
|
fill_color: Some(Color::White),
|
||||||
stroke_color: Some(Color::Black),
|
stroke_color: Some(Color::Black),
|
||||||
stroke_width: 0u8, // Has no effect on fonts
|
stroke_width: 0u8, // Has no effect on fonts
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ impl Default for Display1in54 {
|
||||||
impl Drawing<Color> for Display1in54 {
|
impl Drawing<Color> for Display1in54 {
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = Pixel<Color>>,
|
T: IntoIterator<Item = Pixel<Color>>,
|
||||||
{
|
{
|
||||||
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +78,7 @@ mod tests {
|
||||||
let mut display = Display1in54::default();
|
let mut display = Display1in54::default();
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 192), Coord::new(0, 199))
|
Line::new(Coord::new(0, 192), Coord::new(0, 199))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(192, 199), Coord::new(199, 199))
|
Line::new(Coord::new(192, 199), Coord::new(199, 199))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(199, 0), Coord::new(199, 7))
|
Line::new(Coord::new(199, 0), Coord::new(199, 7))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
//! // Write some hello world in the screenbuffer
|
//! // Write some hello world in the screenbuffer
|
||||||
//! display.draw(
|
//! display.draw(
|
||||||
//! Font6x8::render_str("Hello World!")
|
//! Font6x8::render_str("Hello World!")
|
||||||
//! .with_stroke(Some(Color::Black))
|
//! .stroke(Some(Color::Black))
|
||||||
//! .with_fill(Some(Color::White))
|
//! .fill(Some(Color::White))
|
||||||
//! .translate(Coord::new(5, 50))
|
//! .translate(Coord::new(5, 50))
|
||||||
//! .into_iter(),
|
//! .into_iter(),
|
||||||
//! );
|
//! );
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ impl Default for Display2in9 {
|
||||||
impl Drawing<Color> for Display2in9 {
|
impl Drawing<Color> for Display2in9 {
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = Pixel<Color>>,
|
T: IntoIterator<Item = Pixel<Color>>,
|
||||||
{
|
{
|
||||||
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
//! // Write some hello world in the screenbuffer
|
//! // Write some hello world in the screenbuffer
|
||||||
//! display.draw(
|
//! display.draw(
|
||||||
//! Font6x8::render_str("Hello World!")
|
//! Font6x8::render_str("Hello World!")
|
||||||
//! .with_stroke(Some(Color::Black))
|
//! .stroke(Some(Color::Black))
|
||||||
//! .with_fill(Some(Color::White))
|
//! .fill(Some(Color::White))
|
||||||
//! .translate(Coord::new(5, 50))
|
//! .translate(Coord::new(5, 50))
|
||||||
//! .into_iter(),
|
//! .into_iter(),
|
||||||
//! );
|
//! );
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ impl Default for Display4in2 {
|
||||||
impl Drawing<Color> for Display4in2 {
|
impl Drawing<Color> for Display4in2 {
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = Pixel<Color>>,
|
T: IntoIterator<Item = Pixel<Color>>,
|
||||||
{
|
{
|
||||||
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
self.draw_helper(WIDTH, HEIGHT, item_pixels);
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ mod tests {
|
||||||
let mut display = Display4in2::default();
|
let mut display = Display4in2::default();
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate90);
|
display.set_rotation(DisplayRotation::Rotate90);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 392), Coord::new(0, 399))
|
Line::new(Coord::new(0, 392), Coord::new(0, 399))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate180);
|
display.set_rotation(DisplayRotation::Rotate180);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(392, 299), Coord::new(399, 299))
|
Line::new(Coord::new(392, 299), Coord::new(399, 299))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ mod tests {
|
||||||
display.set_rotation(DisplayRotation::Rotate270);
|
display.set_rotation(DisplayRotation::Rotate270);
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(299, 0), Coord::new(299, 7))
|
Line::new(Coord::new(299, 0), Coord::new(299, 7))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ pub trait Display: Drawing<Color> {
|
||||||
/// Becomes uneccesary when const_generics become stablised
|
/// Becomes uneccesary when const_generics become stablised
|
||||||
fn draw_helper<T>(&mut self, width: u32, height: u32, item_pixels: T)
|
fn draw_helper<T>(&mut self, width: u32, height: u32, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = Pixel<Color>>,
|
T: IntoIterator<Item = Pixel<Color>>,
|
||||||
{
|
{
|
||||||
let rotation = self.rotation();
|
let rotation = self.rotation();
|
||||||
let buffer = self.get_mut_buffer();
|
let buffer = self.get_mut_buffer();
|
||||||
|
|
@ -95,7 +95,7 @@ pub trait Display: Drawing<Color> {
|
||||||
///
|
///
|
||||||
/// display.draw(
|
/// display.draw(
|
||||||
/// Line::new(Coord::new(0, 120), Coord::new(0, 295))
|
/// Line::new(Coord::new(0, 120), Coord::new(0, 295))
|
||||||
/// .with_stroke(Some(Color::Black))
|
/// .stroke(Some(Color::Black))
|
||||||
/// .into_iter(),
|
/// .into_iter(),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
|
|
@ -122,7 +122,7 @@ impl<'a> VarDisplay<'a> {
|
||||||
impl<'a> Drawing<Color> for VarDisplay<'a> {
|
impl<'a> Drawing<Color> for VarDisplay<'a> {
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = Pixel<Color>>,
|
T: IntoIterator<Item = Pixel<Color>>,
|
||||||
{
|
{
|
||||||
self.draw_helper(self.width, self.height, item_pixels);
|
self.draw_helper(self.width, self.height, item_pixels);
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +249,7 @@ mod tests {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
Line::new(Coord::new(0, 0), Coord::new(7, 0))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -275,7 +275,7 @@ mod tests {
|
||||||
|
|
||||||
display.draw(
|
display.draw(
|
||||||
Line::new(Coord::new(0, 120), Coord::new(0, 295))
|
Line::new(Coord::new(0, 120), Coord::new(0, 295))
|
||||||
.with_stroke(Some(Color::Black))
|
.stroke(Some(Color::Black))
|
||||||
.into_iter(),
|
.into_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@
|
||||||
//! // Write some hello world in the screenbuffer
|
//! // Write some hello world in the screenbuffer
|
||||||
//! display.draw(
|
//! display.draw(
|
||||||
//! Font6x8::render_str("Hello World!")
|
//! Font6x8::render_str("Hello World!")
|
||||||
//! .with_stroke(Some(Color::Black))
|
//! .stroke(Some(Color::Black))
|
||||||
//! .with_fill(Some(Color::White))
|
//! .fill(Some(Color::White))
|
||||||
//! .translate(Coord::new(5, 50))
|
//! .translate(Coord::new(5, 50))
|
||||||
//! .into_iter(),
|
//! .into_iter(),
|
||||||
//! );
|
//! );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue