From 9cf298b6107b10838cb23c5011676e44c4a2c9c8 Mon Sep 17 00:00:00 2001 From: Erik Hedvall Date: Sun, 12 Jan 2025 14:13:40 +0100 Subject: [PATCH] Deprecate `encoding::gamma` and its content --- palette/src/encoding.rs | 5 +++++ palette/src/lib.rs | 2 ++ palette/src/luma.rs | 12 +++++++++++- palette/src/rgb.rs | 11 +++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/palette/src/encoding.rs b/palette/src/encoding.rs index 21d922ae6..dc07362e9 100644 --- a/palette/src/encoding.rs +++ b/palette/src/encoding.rs @@ -6,6 +6,7 @@ //! prevent accidental mixups. pub use self::adobe::AdobeRgb; +#[allow(deprecated)] pub use self::gamma::{F2p2, Gamma}; pub use self::linear::Linear; pub use self::p3::{DciP3, DciP3Plus, DisplayP3}; @@ -14,6 +15,10 @@ pub use self::rec_standards::{Rec2020, Rec709}; pub use self::srgb::Srgb; pub mod adobe; +#[deprecated( + since = "0.7.7", + note = "`Gamma`, `GammaFn` and `F2p2` are error prone and incorrectly implemented. See `palette::encoding` for possible alternatives or implement `palette::encoding::FromLinear` and `palette::encoding::IntoLinear` for a custom type." +)] pub mod gamma; pub mod linear; pub mod p3; diff --git a/palette/src/lib.rs b/palette/src/lib.rs index 048be73cd..60fd5c60b 100644 --- a/palette/src/lib.rs +++ b/palette/src/lib.rs @@ -298,6 +298,7 @@ pub use lch::{Lch, Lcha}; #[doc(inline)] pub use lchuv::{Lchuv, Lchuva}; #[doc(inline)] +#[allow(deprecated)] pub use luma::{GammaLuma, GammaLumaa, LinLuma, LinLumaa, SrgbLuma, SrgbLumaa}; #[doc(inline)] pub use luv::{Luv, Luva}; @@ -312,6 +313,7 @@ pub use oklab::{Oklab, Oklaba}; #[doc(inline)] pub use oklch::{Oklch, Oklcha}; #[doc(inline)] +#[allow(deprecated)] pub use rgb::{ AdobeRgb, AdobeRgba, GammaSrgb, GammaSrgba, LinAdobeRgb, LinAdobeRgba, LinRec2020, LinSrgb, LinSrgba, Rec2020, Rec709, Srgb, Srgba, diff --git a/palette/src/luma.rs b/palette/src/luma.rs index cc9502fe1..6b3b5d928 100644 --- a/palette/src/luma.rs +++ b/palette/src/luma.rs @@ -3,7 +3,7 @@ pub mod channels; #[allow(clippy::module_inception)] mod luma; - +#[allow(deprecated)] use crate::encoding::{Gamma, Linear, Srgb}; use crate::white_point::D65; @@ -22,8 +22,18 @@ pub type LinLuma = Luma, T>; pub type LinLumaa = Lumaa, T>; /// Gamma 2.2 encoded luminance. +#[deprecated( + since = "0.7.7", + note = "`Gamma`, `GammaFn` and `F2p2` are error prone and incorrectly implemented. See `palette::encoding` for possible alternatives or implement `palette::encoding::FromLinear` and `palette::encoding::IntoLinear` for a custom type." +)] +#[allow(deprecated)] pub type GammaLuma = Luma, T>; /// Gamma 2.2 encoded luminance with an alpha component. +#[deprecated( + since = "0.7.7", + note = "`Gamma`, `GammaFn` and `F2p2` are error prone and incorrectly implemented. See `palette::encoding` for possible alternatives or implement `palette::encoding::FromLinear` and `palette::encoding::IntoLinear` for a custom type." +)] +#[allow(deprecated)] pub type GammaLumaa = Lumaa, T>; /// A white point and a transfer function. diff --git a/palette/src/rgb.rs b/palette/src/rgb.rs index 94b37f6a5..dadaa65b5 100644 --- a/palette/src/rgb.rs +++ b/palette/src/rgb.rs @@ -60,6 +60,7 @@ //! colors correctly and still allow advanced users a high degree of //! flexibility. +#[allow(deprecated)] use crate::{ encoding::{self, FromLinear, Gamma, IntoLinear, Linear}, stimulus::{FromStimulus, Stimulus}, @@ -121,6 +122,11 @@ pub type LinSrgba = Rgba, T>; /// from `u8` at the same time. /// /// See [`Rgb`] for more details on how to create a value and use it. +#[deprecated( + since = "0.7.7", + note = "`Gamma`, `GammaFn` and `F2p2` are error prone and incorrectly implemented. See `palette::encoding` for possible alternatives or implement `palette::encoding::FromLinear` and `palette::encoding::IntoLinear` for a custom type." +)] +#[allow(deprecated)] pub type GammaSrgb = Rgb, T>; /// Gamma 2.2 encoded sRGB with an alpha component. @@ -132,6 +138,11 @@ pub type GammaSrgb = Rgb, T>; /// /// See [`Rgb`], [`Rgba`] and [`Alpha`](crate::Alpha) for more details on how to /// create a value and use it. +#[deprecated( + since = "0.7.7", + note = "`Gamma`, `GammaFn` and `F2p2` are error prone and incorrectly implemented. See `palette::encoding` for possible alternatives or implement `palette::encoding::FromLinear` and `palette::encoding::IntoLinear` for a custom type." +)] +#[allow(deprecated)] pub type GammaSrgba = Rgba, T>; /// Non-linear Adobe RGB.