| 1 | #[allow(deprecated)] |
| 2 | use superrust-analyzer cargo rgb 0.8.53 legacy/internal/::pixelrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/::ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#; |
| 3 | use superrust-analyzer cargo rgb 0.8.53 legacy/internal/::pixelrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/::{ComponentMaprust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentMap#, ColorComponentMaprust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ColorComponentMap#}; |
| 4 | #[cfg(feature = "as-bytes")] |
| 5 | use superrust-analyzer cargo rgb 0.8.53 legacy/internal/::pixelrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/::ComponentBytesrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentBytes#; |
| 6 | use craterust-analyzer cargo rgb 0.8.53 crate/::altrust-analyzer cargo rgb 0.8.53 legacy/alt/::{BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#, ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#, BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#}; |
| 7 | use craterust-analyzer cargo rgb 0.8.53 crate/::{RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#}; |
| 8 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/; |
| 9 | |
| 10 | impl<T, A> RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, A> { |
| 11 | #[inline(always)] |
| 12 | /// Convenience function for creating a new pixel |
| 13 | /// The order of arguments is R,G,B,A |
| 14 | pub const fn new_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`]new_alpha().(r: T, g: T, b: T, a: A) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`] { |
| 15 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`] { rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r., grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g., brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b., arust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#a. } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | impl<T> BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T> { |
| 20 | #[inline(always)] |
| 21 | /// Convenience function for creating a new pixel |
| 22 | /// Warning: The order of arguments is R,G,B,A |
| 23 | #[deprecated(note = "This function has a misleading order of arguments. Use BGRA{} literal instead")] |
| 24 | pub const fn newrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T>`]new().(r: T, g: T, b: T, a: T) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T>`] { |
| 25 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T>`] { brust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#b., grust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#g., rrust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#r., arust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#a. } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | /// ```rust,compile_fail |
| 30 | /// let r = rgb::BGRA::<u8,u16>::zeroed(); |
| 31 | /// ``` |
| 32 | impl<T, A> BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T, A> { |
| 33 | #[inline(always)] |
| 34 | /// Convenience function for creating a new pixel |
| 35 | /// Warning: The order of arguments is R,G,B,A |
| 36 | #[deprecated(note = "This function has a misleading order of arguments. Use BGRA{} literal instead")] |
| 37 | pub const fn new_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]new_alpha().(r: T, g: T, b: T, a: A) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`] { |
| 38 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`] { brust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#b., grust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#g., rrust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#r., arust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#a. } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | impl<T> ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T> { |
| 43 | #[inline(always)] |
| 44 | /// Convenience function for creating a new pixel |
| 45 | /// The order of arguments is R,G,B,A |
| 46 | #[deprecated(note = "This function has a misleading order of arguments. Use ARGB{} literal instead")] |
| 47 | pub const fn newrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T>`]new().(r: T, g: T, b: T, a: T) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T>`] { |
| 48 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T>`] { arust-analyzer cargo rgb 0.8.53 formats/argb/Argb#a., rrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#r., grust-analyzer cargo rgb 0.8.53 formats/argb/Argb#g., brust-analyzer cargo rgb 0.8.53 formats/argb/Argb#b. } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | impl<T, A> ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T, A> { |
| 53 | #[inline(always)] |
| 54 | /// Convenience function for creating a new pixel |
| 55 | /// The order of arguments is R,G,B,A |
| 56 | #[deprecated(note = "This function has a misleading order of arguments. Use ARGB{} literal instead")] |
| 57 | pub const fn new_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T, A>`]new_alpha().(r: T, g: T, b: T, a: A) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T, A>`] { |
| 58 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T, A>`] { arust-analyzer cargo rgb 0.8.53 formats/argb/Argb#a., rrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#r., grust-analyzer cargo rgb 0.8.53 formats/argb/Argb#g., brust-analyzer cargo rgb 0.8.53 formats/argb/Argb#b. } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | impl<T> ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T> { |
| 63 | #[inline(always)] |
| 64 | /// Convenience function for creating a new pixel |
| 65 | /// The order of arguments is R,G,B,A |
| 66 | #[deprecated(note = "This function has a misleading order of arguments. Use ABGR{} literal instead")] |
| 67 | pub const fn newrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T>`]new().(r: T, g: T, b: T, a: T) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T>`] { |
| 68 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T>`] { arust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#a., brust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#b., grust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#g., rrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#r. } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | impl<T, A> ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T, A> { |
| 73 | #[inline(always)] |
| 74 | /// Convenience function for creating a new pixel |
| 75 | /// The order of arguments is R,G,B,A |
| 76 | #[deprecated(note = "This function has a misleading order of arguments. Use ABGR{} literal instead")] |
| 77 | pub const fn new_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T, A>`]new_alpha().(r: T, g: T, b: T, a: A) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T, A>`] { |
| 78 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ABGR<T, A>`] { arust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#a., brust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#b., grust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#g., rrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#r. } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | macro_rules! impl_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_rgba! { |
| 83 | ($RGBA:ident) => { |
| 84 | impl<T: Clone> $RGBA<T> { |
| 85 | /// Iterate over all components (length=4) |
| 86 | #[inline(always)] |
| 87 | pub fn iter(&self) -> core::iter::Cloned<core::slice::Iter<'_, T>> { |
| 88 | #[allow(deprecated)] |
| 89 | ComponentSlice::as_slice(self).iter().cloned() |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | impl<T: Clone, A> $RGBA<T, A> { |
| 94 | /// Copy RGB components out of the RGBA struct |
| 95 | /// |
| 96 | /// Note: you can use `.into()` to convert between other types |
| 97 | #[inline(always)] |
| 98 | pub fn bgr(&self) -> BGR<T> { |
| 99 | BGR { |
| 100 | r: self.r.clone(), |
| 101 | g: self.g.clone(), |
| 102 | b: self.b.clone(), |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | impl<T: Copy, A: Clone> $RGBA<T, A> { |
| 108 | /// Create new RGBA with the same alpha value, but different RGB values |
| 109 | #[deprecated(note = "Renamed to map_colors()")] |
| 110 | pub fn map_rgb<F, U, B>(&self, mut f: F) -> $RGBA<U, B> |
| 111 | where F: FnMut(T) -> U, U: Clone, B: From<A> + Clone |
| 112 | { |
| 113 | $RGBA { |
| 114 | r: f(self.r), |
| 115 | g: f(self.g), |
| 116 | b: f(self.b), |
| 117 | a: self.a.clone().into(), |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | #[doc(hidden)] |
| 122 | #[deprecated(note = "use .with_alpha(a) instead")] |
| 123 | /// Create a new RGBA with the new alpha value, but same RGB values |
| 124 | pub fn alpha(&self, a: A) -> Self { |
| 125 | self.with_alpha(a) |
| 126 | } |
| 127 | |
| 128 | #[inline(always)] |
| 129 | /// Create a new RGBA with the new alpha value, but same RGB values |
| 130 | pub fn with_alpha(&self, a: A) -> Self { |
| 131 | Self { r: self.r, g: self.g, b: self.b, a } |
| 132 | } |
| 133 | |
| 134 | /// Create a new RGBA with a new alpha value created by the callback. |
| 135 | /// Allows changing of the type used for the alpha channel. |
| 136 | #[inline] |
| 137 | pub fn map_alpha<F, B>(&self, f: F) -> $RGBA<T, B> |
| 138 | where F: FnOnce(A) -> B { |
| 139 | $RGBA { |
| 140 | r: self.r, |
| 141 | g: self.g, |
| 142 | b: self.b, |
| 143 | a: f(self.a.clone()), |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | impl<T: Copy, B> ComponentMap<$RGBA<B>, T, B> for $RGBA<T> { |
| 149 | #[inline(always)] |
| 150 | fn map<F>(&self, mut f: F) -> $RGBA<B> |
| 151 | where F: FnMut(T) -> B { |
| 152 | $RGBA { |
| 153 | r: f(self.r), |
| 154 | g: f(self.g), |
| 155 | b: f(self.b), |
| 156 | a: f(self.a), |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | impl<T: Copy, A: Copy, B> ColorComponentMap<$RGBA<B, A>, T, B> for $RGBA<T, A> { |
| 162 | #[inline(always)] |
| 163 | fn map_colors<F>(&self, mut f: F) -> $RGBA<B, A> |
| 164 | where F: FnMut(T) -> B { |
| 165 | $RGBA { |
| 166 | r: f(self.r), |
| 167 | g: f(self.g), |
| 168 | b: f(self.b), |
| 169 | a: self.a, |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | #[allow(deprecated)] |
| 175 | impl<T> ComponentSlice<T> for $RGBA<T> { |
| 176 | #[inline(always)] |
| 177 | fn as_slice(&self) -> &[T] { |
| 178 | unsafe { |
| 179 | core::slice::from_raw_parts(self as *const Self as *const T, 4) |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | #[inline(always)] |
| 184 | fn as_mut_slice(&mut self) -> &mut [T] { |
| 185 | unsafe { |
| 186 | core::slice::from_raw_parts_mut(self as *mut Self as *mut T, 4) |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | #[allow(deprecated)] |
| 192 | impl<T> ComponentSlice<T> for [$RGBA<T>] { |
| 193 | #[inline] |
| 194 | fn as_slice(&self) -> &[T] { |
| 195 | unsafe { |
| 196 | core::slice::from_raw_parts(self.as_ptr() as *const _, self.len() * 4) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | #[inline] |
| 201 | fn as_mut_slice(&mut self) -> &mut [T] { |
| 202 | unsafe { |
| 203 | core::slice::from_raw_parts_mut(self.as_mut_ptr() as *mut _, self.len() * 4) |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | #[cfg(feature = "as-bytes")] |
| 209 | impl<T: crate::Pod> ComponentBytes<T> for [$RGBA<T>] {} |
| 210 | }; |
| 211 | } |
| 212 | |
| 213 | macro_rules! impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv! { |
| 214 | ($RGB:ident, $RGBA:ident) => { |
| 215 | /// Assumes 255 is opaque |
| 216 | impl<T: Copy> From<$RGB<T>> for $RGBA<T, u8> { |
| 217 | #[inline(always)] |
| 218 | fn from(other: $RGB<T>) -> Self { |
| 219 | Self { |
| 220 | r: other.r, |
| 221 | g: other.g, |
| 222 | b: other.b, |
| 223 | a: 0xFF, |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /// Assumes 65535 is opaque |
| 229 | impl<T: Copy> From<$RGB<T>> for $RGBA<T, u16> { |
| 230 | #[inline(always)] |
| 231 | fn from(other: $RGB<T>) -> Self { |
| 232 | Self { |
| 233 | r: other.r, |
| 234 | g: other.g, |
| 235 | b: other.b, |
| 236 | a: 0xFFFF, |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | }; |
| 241 | } |
| 242 | |
| 243 | impl<T, A> RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, A> { |
| 244 | /// Provide a mutable view of only RGB components (leaving out alpha). |
| 245 | /// Useful to change color without changing opacity. |
| 246 | #[inline(always)] |
| 247 | pub fn rgb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`]rgb_mut().(&mut self) -> &mut RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 248 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T>>() } |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | impl<T, A> BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T, A> { |
| 253 | /// Provide a mutable view of only RGB components (leaving out alpha). |
| 254 | /// Useful to change color without changing opacity. |
| 255 | #[deprecated(note = "This function will change. Use bgr_mut()")] |
| 256 | pub fn rgb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]rgb_mut().(&mut self) -> &mut BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T> { |
| 257 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>>() } |
| 258 | } |
| 259 | |
| 260 | /// Provide a mutable view of only RGB components (leaving out alpha). |
| 261 | /// Useful to change color without changing opacity. |
| 262 | #[inline(always)] |
| 263 | pub fn bgr_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]bgr_mut().(&mut self) -> &mut BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T> { |
| 264 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>>() } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | impl<T> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<T> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T> { |
| 269 | #[inline(always)] |
| 270 | /// Takes exactly 4 elements from the iterator and creates a new instance. |
| 271 | /// Panics if there are fewer elements in the iterator. |
| 272 | fn from_iterrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T>`][`FromIterator<T>`]from_iter().<I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = T>>(into_iter: I) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T>`][`FromIterator<T>`] { |
| 273 | let mut iter = into_iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().(); |
| 274 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T>`][`FromIterator<T>`] { |
| 275 | rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r.: iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 276 | grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g.: iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 277 | brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b.: iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 278 | arust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#a.: iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, A> RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, A> { |
| 284 | /// Copy RGB components out of the RGBA struct |
| 285 | /// |
| 286 | /// Note: you can use `.into()` to convert between other types |
| 287 | #[inline(always)] |
| 288 | pub fn rgbrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`]rgb().(&self) -> RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 289 | RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb# { |
| 290 | rrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#r.: self.rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 291 | grust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#g.: self.grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 292 | brust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#b.: self.brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, A> ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T, A> { |
| 298 | /// Copy RGB components out of the ARGB struct |
| 299 | /// |
| 300 | /// Note: you can use `.into()` to convert between other types |
| 301 | #[inline(always)] |
| 302 | pub fn rgbrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`ARGB<T, A>`]rgb().(&self) -> RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 303 | RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb# { |
| 304 | rrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#r.: self.rrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#r..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 305 | grust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#g.: self.grust-analyzer cargo rgb 0.8.53 formats/argb/Argb#g..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 306 | brust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#b.: self.brust-analyzer cargo rgb 0.8.53 formats/argb/Argb#b..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, A> BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T, A> { |
| 312 | /// Copy RGB components out of the RGBA struct |
| 313 | /// |
| 314 | /// Note: you can use `.into()` to convert between other types |
| 315 | #[deprecated(note = "This function will change. Use bgr()")] |
| 316 | pub fn rgbrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`]rgb().(&self) -> BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T> { |
| 317 | BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr# { |
| 318 | rrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#r.: self.rrust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#r..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 319 | grust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#g.: self.grust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#g..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 320 | brust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#b.: self.brust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#b..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | impl_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_rgba!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#} |
| 326 | impl_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_rgba!! {BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#} |
| 327 | impl_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_rgba!! {ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#} |
| 328 | impl_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_rgba!! {ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#} |
| 329 | |
| 330 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#} |
| 331 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#} |
| 332 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#} |
| 333 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#} |
| 334 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#} |
| 335 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#} |
| 336 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#} |
| 337 | impl_alpha_convrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl_alpha_conv!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#} |
| 338 | |
| 339 | impl<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, A: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, A> { |
| 340 | fn fmtrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`RGBA<T, A>`][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 341 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "rgba({},{},{},{})", self.rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r., self.grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g., self.brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b., self.arust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#a.) |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | impl<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, A: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T, A> { |
| 346 | fn fmtrust-analyzer cargo rgb 0.8.53 legacy/internal/rgba/impl#[`BGRA<T, A>`][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 347 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "bgra({},{},{},{})", self.rrust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#r., self.grust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#g., self.brust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#b., self.arust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#a.) |
| 348 | } |
| 349 | } |
| 350 |