1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-28 15:22:14 +00:00

feat(eckhart): add alpha to ScreenBorder

This commit is contained in:
obrusvit 2025-02-23 11:43:36 +01:00 committed by Vít Obrusník
parent 119748d743
commit 483b1d8c07

View File

@ -64,32 +64,48 @@ impl ScreenBorder {
self.side_bars[0].width()
}
pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
pub fn render<'s>(&'s self, alpha: u8, target: &mut impl Renderer<'s>) {
let screen = constant::screen();
// Draw the four side bars.
for bar in self.side_bars {
shape::Bar::new(bar)
self.side_bars.iter().for_each(|bar| {
shape::Bar::new(*bar)
.with_fg(self.color)
.with_thickness(2)
.with_alpha(alpha)
.render(target);
}
});
// Draw the four corners.
shape::ToifImage::new(screen.bottom_left(), ICON_BORDER_BL.toif)
[
(
screen.bottom_left(),
ICON_BORDER_BL.toif,
Alignment2D::BOTTOM_LEFT,
),
(
screen.top_right(),
ICON_BORDER_TR.toif,
Alignment2D::TOP_RIGHT,
),
(
screen.top_left(),
ICON_BORDER_TL.toif,
Alignment2D::TOP_LEFT,
),
(
screen.bottom_right(),
ICON_BORDER_BR.toif,
Alignment2D::BOTTOM_RIGHT,
),
]
.iter()
.for_each(|(position, toif, alignment)| {
shape::ToifImage::new(*position, *toif)
.with_fg(self.color)
.with_align(Alignment2D::BOTTOM_LEFT)
.render(target);
shape::ToifImage::new(screen.top_right(), ICON_BORDER_TR.toif)
.with_fg(self.color)
.with_align(Alignment2D::TOP_RIGHT)
.render(target);
shape::ToifImage::new(screen.top_left(), ICON_BORDER_TL.toif)
.with_fg(self.color)
.with_align(Alignment2D::TOP_LEFT)
.render(target);
shape::ToifImage::new(screen.bottom_right(), ICON_BORDER_BR.toif)
.with_fg(self.color)
.with_align(Alignment2D::BOTTOM_RIGHT)
.with_align(*alignment)
.with_alpha(alpha)
.render(target);
});
}
}