Skip to content

Commit

Permalink
Deprecate encoding::gamma and its content
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogeon committed Jan 12, 2025
1 parent f509ebd commit 9cf298b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions palette/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions palette/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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,
Expand Down
12 changes: 11 additions & 1 deletion palette/src/luma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -22,8 +22,18 @@ pub type LinLuma<Wp = D65, T = f32> = Luma<Linear<Wp>, T>;
pub type LinLumaa<Wp = D65, T = f32> = Lumaa<Linear<Wp>, 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<T = f32> = Luma<Gamma<D65>, 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<T = f32> = Lumaa<Gamma<D65>, T>;

/// A white point and a transfer function.
Expand Down
11 changes: 11 additions & 0 deletions palette/src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -121,6 +122,11 @@ pub type LinSrgba<T = f32> = Rgba<Linear<encoding::Srgb>, 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<T = f32> = Rgb<Gamma<encoding::Srgb>, T>;

/// Gamma 2.2 encoded sRGB with an alpha component.
Expand All @@ -132,6 +138,11 @@ pub type GammaSrgb<T = f32> = Rgb<Gamma<encoding::Srgb>, 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<T = f32> = Rgba<Gamma<encoding::Srgb>, T>;

/// Non-linear Adobe RGB.
Expand Down

0 comments on commit 9cf298b

Please sign in to comment.