diff --git a/src/formats/gray.rs b/src/formats/gray.rs index 9cd6c9f7..c07b2f6b 100644 --- a/src/formats/gray.rs +++ b/src/formats/gray.rs @@ -84,3 +84,30 @@ impl core::ops::Deref for Gray_v08 { &self.0 } } + +impl Gray_v08 { + /// Reads the `.0` field + /// + /// This is a compatibility shim. Migrate to `Gray_v09` and use `.v` directly. + #[deprecated(since = "0.8.91", note = "Use Gray_v09 with .v field instead")] + pub fn value(self) -> T { + self.0 + } + + /// Exposes the `.0` field for writing + /// + /// This is a compatibility shim. Migrate to `Gray_v09` and use `.v` directly. + #[deprecated(since = "0.8.91", note = "Use Gray_v09 with .v field instead")] + pub fn value_mut(&mut self) -> &mut T { + &mut self.0 + } + + /// Add alpha component to this pixel + /// + /// This is a compatibility shim. Migrate to `Gray_v09` and use `GrayA` instead. + #[deprecated(since = "0.8.91", note = "Use Gray_v09::with_alpha() or GrayA instead")] + #[allow(deprecated)] + pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_alpha::GrayAlpha_v08 { + crate::formats::gray_alpha::GrayAlpha_v08(self.0, add_alpha_value) + } +} diff --git a/src/formats/gray_alpha.rs b/src/formats/gray_alpha.rs index 7d9dda56..238b8a33 100644 --- a/src/formats/gray_alpha.rs +++ b/src/formats/gray_alpha.rs @@ -1,6 +1,5 @@ use crate::formats::gray_a::GrayA; -use core::ops::Deref; -use core::ops::DerefMut; +use core::ops::{Deref, DerefMut}; #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -45,10 +44,19 @@ impl DerefMut for GrayAlpha_v08 { impl GrayAlpha_v08 { /// Value - the brightness component. May be luma or luminance. /// - /// Backwards-compatible getter for `self.v` + /// This is a compatibility shim. Migrate to `GrayA` and use `.v` directly. + #[deprecated(since = "0.8.91", note = "Use GrayA with .v field instead")] pub fn value(&self) -> T { self.0.clone() } + + /// Exposes the `.0` field for writing + /// + /// This is a compatibility shim. Migrate to `GrayA` and use `.v` directly. + #[deprecated(since = "0.8.91", note = "Use GrayA with .v field instead")] + pub fn value_mut(&mut self) -> &mut T { + &mut self.0 + } } #[test]