use core::fmt::Debug;

use embedded_graphics::draw_target::DrawTarget;
use embedded_graphics::iterator::raw::RawDataSlice;
use embedded_graphics::pixelcolor::raw::BigEndian;
use embedded_graphics::pixelcolor::{PixelColor, Rgb888};
use embedded_graphics::text::renderer::TextRenderer;
use mplusfonts::color::{Invert, Screen, WeightedAvg};
use mplusfonts::style::BitmapFontStyle;

use crate::backend::DumoBackend;
#[cfg(feature = "alloc")]
use crate::blink::{Blink, ControlBlinking};
#[cfg(feature = "alloc")]
use crate::cursor::Cursor;
#[cfg(feature = "alloc")]
use crate::wrapper::blink::BlinkWrapper;
#[cfg(feature = "alloc")]
use crate::wrapper::cursor::CursorWrapper;
use crate::wrapper::flush::FlushWrapper;
#[cfg(feature = "alloc")]
use crate::wrapper::wrap::BLINKING;

impl_wrapper!(
    FlushWrapper<F>(F: FnMut(&mut D) -> Result<(), D::Error>),
    DumoBackend<'a, 'b, '_, '_, D, C>,
    #[cfg(feature = "alloc")]
    impl_with_blink!(self, BLINKING);
    #[cfg(feature = "alloc")]
    impl_with_cursor!('c, self, BLINKING);
);

#[cfg(feature = "alloc")]
impl_wrapper!(
    FlushWrapper<F>(F: FnMut(&mut D) -> Result<(), D::Error>),
    BlinkWrapper<DumoBackend<'a, 'b, '_, '_, D, C>, D>,
    impl_with_cursor!('c, self, BLINKING);
);

#[cfg(feature = "alloc")]
impl_wrapper!(
    FlushWrapper<F>(F: FnMut(&mut D) -> Result<(), D::Error>),
    CursorWrapper<'_, DumoBackend<'a, 'b, '_, '_, D, C>, D>,
    impl_with_blink!(self, BLINKING);
);
