use std::marker::PhantomData;

pub struct RgbFormat;

impl RgbFormat {
    const COMPONENTS_COUNT: usize = 3;
}

pub struct RgbaFormat;

impl RgbaFormat {
    const COMPONENTS_COUNT: usize = 4;
}

pub struct Image<Format = RgbFormat> {
    pub data: Vec<u8>,
    pub width: usize,
    pub height: usize,
    format: PhantomData<Format>,
}

macro_rules! image_with_format {
    ($format:ident) => {
        impl Image<$format> {
            pub fn get_pixel(&self, x: usize, y: usize) -> &[u8; $format::COMPONENTS_COUNT] {
                todo!()
            }

            pub fn set_pixel(&self, x: usize, y: usize, pixel: [u8; $format::COMPONENTS_COUNT]) {
                todo!()
            }
        }
    }
}

image_with_format!{RgbFormat}
image_with_format!{RgbaFormat}