use crate::{gamma_from_linear, linear_from_gamma, Color32, Hsva, Rgba};
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct HsvaGamma {
pub h: f32,
pub s: f32,
pub v: f32,
pub a: f32,
}
impl From<HsvaGamma> for Rgba {
fn from(hsvag: HsvaGamma) -> Self {
Hsva::from(hsvag).into()
}
}
impl From<HsvaGamma> for Color32 {
fn from(hsvag: HsvaGamma) -> Self {
Rgba::from(hsvag).into()
}
}
impl From<HsvaGamma> for Hsva {
fn from(hsvag: HsvaGamma) -> Self {
let HsvaGamma { h, s, v, a } = hsvag;
Self {
h,
s,
v: linear_from_gamma(v),
a,
}
}
}
impl From<Rgba> for HsvaGamma {
fn from(rgba: Rgba) -> Self {
Hsva::from(rgba).into()
}
}
impl From<Color32> for HsvaGamma {
fn from(srgba: Color32) -> Self {
Hsva::from(srgba).into()
}
}
impl From<Hsva> for HsvaGamma {
fn from(hsva: Hsva) -> Self {
let Hsva { h, s, v, a } = hsva;
Self {
h,
s,
v: gamma_from_linear(v),
a,
}
}
}