use embedded_graphics::{
Drawable, mono_font::MonoTextStyle, pixelcolor::Rgb565, primitives::Rectangle,
};
use crate::{
geometry::Rect,
render::{Compositor, RenderCtx, TextStyle},
};
pub fn rect_to_rectangle(rect: Rect) -> Rectangle {
rect.into()
}
pub fn rectangle_to_rect(rectangle: Rectangle) -> Rect {
rectangle.into()
}
pub fn draw_drawable<D, C, T>(
ctx: &mut RenderCtx<'_, D, C>,
drawable: &T,
) -> Result<T::Output, D::Error>
where
D: embedded_graphics_core::draw_target::DrawTarget<Color = Rgb565>,
C: Compositor<D>,
T: Drawable<Color = Rgb565>,
{
ctx.draw_embedded_graphics(drawable)
}
pub fn text_style_from_mono(mono_style: &MonoTextStyle<'static, Rgb565>) -> TextStyle {
mono_style.into()
}