1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-28 23:32:05 +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() 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(); let screen = constant::screen();
// Draw the four side bars. // Draw the four side bars.
for bar in self.side_bars { self.side_bars.iter().for_each(|bar| {
shape::Bar::new(bar) shape::Bar::new(*bar)
.with_fg(self.color) .with_fg(self.color)
.with_thickness(2) .with_thickness(2)
.with_alpha(alpha)
.render(target); .render(target);
} });
// Draw the four corners. // Draw the four corners.
shape::ToifImage::new(screen.bottom_left(), ICON_BORDER_BL.toif) [
.with_fg(self.color) (
.with_align(Alignment2D::BOTTOM_LEFT) screen.bottom_left(),
.render(target); ICON_BORDER_BL.toif,
shape::ToifImage::new(screen.top_right(), ICON_BORDER_TR.toif) Alignment2D::BOTTOM_LEFT,
.with_fg(self.color) ),
.with_align(Alignment2D::TOP_RIGHT) (
.render(target); screen.top_right(),
shape::ToifImage::new(screen.top_left(), ICON_BORDER_TL.toif) ICON_BORDER_TR.toif,
.with_fg(self.color) Alignment2D::TOP_RIGHT,
.with_align(Alignment2D::TOP_LEFT) ),
.render(target); (
shape::ToifImage::new(screen.bottom_right(), ICON_BORDER_BR.toif) screen.top_left(),
.with_fg(self.color) ICON_BORDER_TL.toif,
.with_align(Alignment2D::BOTTOM_RIGHT) Alignment2D::TOP_LEFT,
.render(target); ),
(
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(*alignment)
.with_alpha(alpha)
.render(target);
});
} }
} }