backlight: Draw container box around bar
This commit is contained in:
+11
-5
@@ -1,6 +1,6 @@
|
|||||||
use crate::buffer::Buffer;
|
use crate::buffer::Buffer;
|
||||||
use crate::color::Color;
|
use crate::color::Color;
|
||||||
use crate::draw::{draw_bar, draw_text, ROBOTO_REGULAR};
|
use crate::draw::{draw_bar, draw_text, draw_box, ROBOTO_REGULAR};
|
||||||
use crate::module::{Input, ModuleImpl};
|
use crate::module::{Input, ModuleImpl};
|
||||||
|
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
@@ -102,21 +102,27 @@ impl ModuleImpl for Backlight {
|
|||||||
_time: &DateTime<Local>,
|
_time: &DateTime<Local>,
|
||||||
) -> Result<Vec<(i32, i32, i32, i32)>, Error> {
|
) -> Result<Vec<(i32, i32, i32, i32)>, Error> {
|
||||||
buf.memset(bg);
|
buf.memset(bg);
|
||||||
|
let c = Color::new(1.0, 1.0, 1.0, 1.0);
|
||||||
draw_text(
|
draw_text(
|
||||||
ROBOTO_REGULAR,
|
ROBOTO_REGULAR,
|
||||||
&mut buf.subdimensions((0, 0, 128, 24)),
|
&mut buf.subdimensions((0, 0, 128, 24)),
|
||||||
bg,
|
bg,
|
||||||
&Color::new(1.0, 1.0, 1.0, 1.0),
|
&c,
|
||||||
24.0,
|
24.0,
|
||||||
"backlight",
|
"backlight",
|
||||||
)?;
|
)?;
|
||||||
draw_bar(
|
draw_bar(
|
||||||
&mut buf.subdimensions((128, 0, 384, 24)),
|
&mut buf.subdimensions((128, 0, 432, 24)),
|
||||||
&Color::new(1.0, 1.0, 1.0, 1.0),
|
&c,
|
||||||
384,
|
432,
|
||||||
24,
|
24,
|
||||||
self.brightness() / 100.0,
|
self.brightness() / 100.0,
|
||||||
)?;
|
)?;
|
||||||
|
draw_box(
|
||||||
|
&mut buf.subdimensions((128, 0, 432, 24)),
|
||||||
|
&c,
|
||||||
|
(432, 24),
|
||||||
|
)?;
|
||||||
Ok(vec![buf.get_signed_bounds()])
|
Ok(vec![buf.get_signed_bounds()])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user