use crate::protocol::{caps::identity::Identity, model::Model};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Film {
#[default]
Positive,
Negative,
Kodachrome,
MonochromeNegative,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Family {
Ls9000,
Ls8000,
Ls5000,
Ls4000,
}
impl Family {
fn of(model: Model) -> Self {
match model {
Model::Ls9000 => Self::Ls9000,
Model::Ls8000 => Self::Ls8000,
Model::Ls5000 | Model::Ls50 => Self::Ls5000,
Model::Ls4000 | Model::Ls40 => Self::Ls4000,
}
}
}
pub const NOTICE: &str = "\
The ICC profiles this program tags its scans with are derived from the ICM
profiles in the Nikon Scan 4 installer, which carry the notice \"Nikon Inc. &
Nikon Corporation 2003\". That notice is retained in each profile.
They are not covered by this program's license, and no license to them is
granted here. Their tables have been altered (the profile class, and the gamma
2.2 encode composed into the curves), so they are not what Nikon shipped and
should not be read as Nikon's characterization.";
macro_rules! profile {
($name:literal) => {
Some(include_bytes!(concat!("../../profiles/", $name, ".icc")).as_slice())
};
}
pub fn nikon(identity: &Identity, film: Film) -> Option<&'static [u8]> {
match (Family::of(identity.model()?), film) {
(Family::Ls9000, Film::Positive) => profile!("NKLS9000_P"),
(Family::Ls9000, Film::Negative) => profile!("NKLS9000_N"),
(Family::Ls9000, Film::Kodachrome) => profile!("NKLS9000_K"),
(Family::Ls9000, Film::MonochromeNegative) => profile!("NKLS9000_MN"),
(Family::Ls8000, Film::Positive) => profile!("NKLS8000_P"),
(Family::Ls8000, Film::Negative) => profile!("NKLS8000_N"),
(Family::Ls8000, Film::Kodachrome) => profile!("NKLS8000_K"),
(Family::Ls8000, Film::MonochromeNegative) => None,
(Family::Ls5000, Film::Positive) => profile!("NKLS5000_P"),
(Family::Ls5000, Film::Negative) => profile!("NKLS5000_N"),
(Family::Ls5000, Film::Kodachrome) => profile!("NKLS5000_K"),
(Family::Ls5000, Film::MonochromeNegative) => profile!("NKLS5000_MN"),
(Family::Ls4000, Film::Positive) => profile!("NKLS4000LS40_P"),
(Family::Ls4000, Film::Negative) => profile!("NKLS4000LS40_N"),
(Family::Ls4000, Film::Kodachrome) => profile!("NKLS4000LS40_K"),
(Family::Ls4000, Film::MonochromeNegative) => None,
}
}