use embedded_graphics::iterator::raw::RawDataSlice;
use embedded_graphics::pixelcolor::PixelColor;
use embedded_graphics::pixelcolor::raw::BigEndian;
use crate::image::{Image, ImageSet};
pub type GlyphId = u16;
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Glyph<'a, C, const N: usize>
where
C: PixelColor + From<C::Raw>,
RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator<Item = C::Raw>,
{
pub id: GlyphId,
pub images: ImageSet<'a, C, N>,
pub next: Option<&'a NextGlyph<'a, C, N>>,
}
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct NextGlyph<'a, C, const N: usize>
where
C: PixelColor + From<C::Raw>,
RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator<Item = C::Raw>,
{
pub x_offset: f32,
pub y_offset: f32,
pub glyph: Glyph<'a, C, N>,
}
impl<'a, C, const N: usize> Glyph<'a, C, N>
where
C: PixelColor + From<C::Raw>,
RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator<Item = C::Raw>,
{
pub const NULL: Self = Self {
id: 0,
images: ImageSet::Repeated(Image::NULL),
next: None,
};
}