#[repr(C)]pub struct Abgr<T, A = T> {
pub a: A,
pub b: T,
pub g: T,
pub r: T,
}
Expand description
An Alpha + Blue + Green + Red
pixel.
§Examples
use rgb::Abgr;
let pixel: Abgr<u8> = Abgr { a: 255, b: 0, g: 0, r: 0 };
Fields§
§a: A
Alpha Component
b: T
Blue Component
g: T
Green Component
r: T
Red Component
Implementations§
Source§impl<T: Copy, A: Clone> Abgr<T, A>
impl<T: Copy, A: Clone> Abgr<T, A>
Sourcepub fn map_rgb<F, U, B>(&self, f: F) -> ABGR<U, B>
👎Deprecated: Renamed to map_colors()
pub fn map_rgb<F, U, B>(&self, f: F) -> ABGR<U, B>
Create new RGBA with the same alpha value, but different RGB values
Sourcepub fn with_alpha(&self, a: A) -> Self
pub fn with_alpha(&self, a: A) -> Self
Create a new RGBA with the new alpha value, but same RGB values
Trait Implementations§
Source§impl<T> AsPixels<Abgr<T>> for [T]
impl<T> AsPixels<Abgr<T>> for [T]
Source§fn as_pixels_mut(&mut self) -> &mut [ABGR<T>]
fn as_pixels_mut(&mut self) -> &mut [ABGR<T>]
Use
::bytemuck::cast_slice_mut()
instead. Read moreSource§impl<T: Copy, A: Copy, B> ColorComponentMap<Abgr<B, A>, T, B> for Abgr<T, A>
impl<T: Copy, A: Copy, B> ColorComponentMap<Abgr<B, A>, T, B> for Abgr<T, A>
Source§impl<T> ComponentSlice<T> for Abgr<T>
impl<T> ComponentSlice<T> for Abgr<T>
Source§impl<'de, T, A> Deserialize<'de> for Abgr<T, A>where
T: Deserialize<'de>,
A: Deserialize<'de>,
impl<'de, T, A> Deserialize<'de> for Abgr<T, A>where
T: Deserialize<'de>,
A: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<R, S> From<(R, R, R, R)> for Abgr<S>where
R: Into<S>,
impl<R, S> From<(R, R, R, R)> for Abgr<S>where
R: Into<S>,
Source§fn from(value: (R, R, R, R)) -> Self
fn from(value: (R, R, R, R)) -> Self
Converts to this type from the input type.
Source§impl<T: Ord, A: Ord> Ord for Abgr<T, A>
impl<T: Ord, A: Ord> Ord for Abgr<T, A>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, A: PartialOrd> PartialOrd for Abgr<T, A>
impl<T: PartialOrd, A: PartialOrd> PartialOrd for Abgr<T, A>
Source§impl<T, A> Zeroable for Abgr<T, A>
impl<T, A> Zeroable for Abgr<T, A>
This is unsound. You can disable as-bytes
feature, enable bytemuck
, and use bytemuck::cast_slice()
instead.
impl<T: Copy, A: Copy> Copy for Abgr<T, A>
impl<T: Eq, A: Eq> Eq for Abgr<T, A>
impl<T, A> Pod for Abgr<T, A>
This is unsound. You can disable as-bytes
feature, enable bytemuck
, and use bytemuck::cast_slice()
instead.
impl<T, A> StructuralPartialEq for Abgr<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for Abgr<T, A>
impl<T, A> RefUnwindSafe for Abgr<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for Abgr<T, A>
impl<T, A> Sync for Abgr<T, A>
impl<T, A> Unpin for Abgr<T, A>
impl<T, A> UnwindSafe for Abgr<T, A>where
A: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.