#[repr(C)]pub struct GreyAlpha<T, A = T>(pub T, pub A);
Expand description
A pixel for grayscale value + alpha components (rgb crate v0.8)
Through a Deref
hack it renames the fields from .0
and .1
to .v
(value) and .a
(alpha)
Tuple Fields§
§0: T
Grayscale Component
This field has been renamed to .v
1: A
Alpha Component. This field has been renamed to .a
.
Implementations§
Source§impl<T> GrayAlpha_v08<T>where
T: Copy,
impl<T> GrayAlpha_v08<T>where
T: Copy,
Source§impl<T> GrayAlpha_v08<T>where
T: Copy,
impl<T> GrayAlpha_v08<T>where
T: Copy,
Sourcepub const fn new(value: T, alpha: T) -> GrayAlpha_v08<T>
pub const fn new(value: T, alpha: T) -> GrayAlpha_v08<T>
Creates a new GrayAlpha_v08
pixel type from its components.
Alternatively, you can use struct literal syntax to create the new pixel type:
use rgb::GrayAlpha_v08;
let pixel = GrayAlpha_v08 {0 : value, 1 : alpha};
Source§impl<T, A> GrayAlpha_v08<T, A>where
T: Clone,
impl<T, A> GrayAlpha_v08<T, A>where
T: Clone,
Source§impl<T, A> GrayAlpha_v08<T, A>
impl<T, A> GrayAlpha_v08<T, A>
Source§impl<T, A> GrayAlpha_v08<T, A>
impl<T, A> GrayAlpha_v08<T, A>
Sourcepub fn with_alpha(&self, a: A) -> GrayAlpha_v08<T, A>
pub fn with_alpha(&self, a: A) -> GrayAlpha_v08<T, A>
Create a new GrayAlpha
with the new alpha value, but same gray value
Sourcepub fn map_alpha<F, B>(&self, f: F) -> GrayAlpha_v08<T, B>where
F: FnOnce(A) -> B,
pub fn map_alpha<F, B>(&self, f: F) -> GrayAlpha_v08<T, B>where
F: FnOnce(A) -> B,
Create a new GrayAlpha
with a new alpha value created by the callback.
Trait Implementations§
Source§impl<T> Add<T> for GrayAlpha_v08<T>
px + 1
impl<T> Add<T> for GrayAlpha_v08<T>
px + 1
Source§impl<T, A> Add for GrayAlpha_v08<T, A>
px + px
impl<T, A> Add for GrayAlpha_v08<T, A>
px + px
Source§impl<T> AddAssign<T> for GrayAlpha_v08<T>
px + 1
impl<T> AddAssign<T> for GrayAlpha_v08<T>
px + 1
Source§fn add_assign(&mut self, r: T)
fn add_assign(&mut self, r: T)
Performs the
+=
operation. Read moreSource§impl<T, A> AddAssign for GrayAlpha_v08<T, A>
px + px
impl<T, A> AddAssign for GrayAlpha_v08<T, A>
px + px
Source§fn add_assign(&mut self, other: GrayAlpha_v08<T, A>)
fn add_assign(&mut self, other: GrayAlpha_v08<T, A>)
Performs the
+=
operation. Read moreSource§impl<T> AsMut<T> for GrayAlpha_v08<T>
impl<T> AsMut<T> for GrayAlpha_v08<T>
Source§impl<T> AsPixels<GrayAlpha_v08<T>> for [T]
impl<T> AsPixels<GrayAlpha_v08<T>> for [T]
Source§fn as_pixels(&self) -> &[GrayAlpha_v08<T>]
fn as_pixels(&self) -> &[GrayAlpha_v08<T>]
Use
::bytemuck::cast_slice()
instead. Read moreSource§fn as_pixels_mut(&mut self) -> &mut [GrayAlpha_v08<T>]
fn as_pixels_mut(&mut self) -> &mut [GrayAlpha_v08<T>]
Use
::bytemuck::cast_slice_mut()
instead. Read moreSource§impl<T> AsRef<T> for GrayAlpha_v08<T>
impl<T> AsRef<T> for GrayAlpha_v08<T>
Source§impl<T, A> Clone for GrayAlpha_v08<T, A>
impl<T, A> Clone for GrayAlpha_v08<T, A>
Source§fn clone(&self) -> GrayAlpha_v08<T, A>
fn clone(&self) -> GrayAlpha_v08<T, A>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, A, B> ColorComponentMap<GrayAlpha_v08<B, A>, T, B> for GrayAlpha_v08<T, A>
impl<T, A, B> ColorComponentMap<GrayAlpha_v08<B, A>, T, B> for GrayAlpha_v08<T, A>
Source§fn map_colors<F>(&self, f: F) -> GrayAlpha_v08<B, A>where
F: FnMut(T) -> B,
fn map_colors<F>(&self, f: F) -> GrayAlpha_v08<B, A>where
F: FnMut(T) -> B,
Convenience function for applying the same formula to every rgb/gray component, but skipping the alpha component. Read more
Source§impl<T, B> ComponentMap<GrayAlpha_v08<B>, T, B> for GrayAlpha_v08<T>where
T: Copy,
impl<T, B> ComponentMap<GrayAlpha_v08<B>, T, B> for GrayAlpha_v08<T>where
T: Copy,
Source§impl<T> ComponentSlice<T> for GrayAlpha_v08<T>
impl<T> ComponentSlice<T> for GrayAlpha_v08<T>
Source§impl<T, A> Debug for GrayAlpha_v08<T, A>
impl<T, A> Debug for GrayAlpha_v08<T, A>
Source§impl<T, A> Default for GrayAlpha_v08<T, A>
impl<T, A> Default for GrayAlpha_v08<T, A>
Source§fn default() -> GrayAlpha_v08<T, A>
fn default() -> GrayAlpha_v08<T, A>
Returns the “default value” for a type. Read more
Source§impl<T, A> Deref for GrayAlpha_v08<T, A>
impl<T, A> Deref for GrayAlpha_v08<T, A>
Source§impl<T> Div<T> for GrayAlpha_v08<T>
px / 1
impl<T> Div<T> for GrayAlpha_v08<T>
px / 1
Source§impl<T> DivAssign<T> for GrayAlpha_v08<T>
px * 1
impl<T> DivAssign<T> for GrayAlpha_v08<T>
px * 1
Source§fn div_assign(&mut self, r: T)
fn div_assign(&mut self, r: T)
Performs the
/=
operation. Read moreSource§impl<R, S> From<(R, R)> for GrayAlpha_v08<S>where
R: Into<S>,
impl<R, S> From<(R, R)> for GrayAlpha_v08<S>where
R: Into<S>,
Source§fn from(value: (R, R)) -> GrayAlpha_v08<S>
fn from(value: (R, R)) -> GrayAlpha_v08<S>
Converts to this type from the input type.
Source§impl<T, A> From<GrayAlpha_v08<T, A>> for Rgba<T, A>where
T: Clone,
impl<T, A> From<GrayAlpha_v08<T, A>> for Rgba<T, A>where
T: Clone,
Source§fn from(other: GrayAlpha_v08<T, A>) -> Rgba<T, A>
fn from(other: GrayAlpha_v08<T, A>) -> Rgba<T, A>
Converts to this type from the input type.
Source§impl<T, A> Hash for GrayAlpha_v08<T, A>
impl<T, A> Hash for GrayAlpha_v08<T, A>
Source§impl<T> Mul<T> for GrayAlpha_v08<T>
px * 1
impl<T> Mul<T> for GrayAlpha_v08<T>
px * 1
Source§impl<T> MulAssign<T> for GrayAlpha_v08<T>
px * 1
impl<T> MulAssign<T> for GrayAlpha_v08<T>
px * 1
Source§fn mul_assign(&mut self, r: T)
fn mul_assign(&mut self, r: T)
Performs the
*=
operation. Read moreSource§impl<T, A> Ord for GrayAlpha_v08<T, A>
impl<T, A> Ord for GrayAlpha_v08<T, A>
Source§fn cmp(&self, other: &GrayAlpha_v08<T, A>) -> Ordering
fn cmp(&self, other: &GrayAlpha_v08<T, A>) -> Ordering
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, A> PartialEq for GrayAlpha_v08<T, A>
impl<T, A> PartialEq for GrayAlpha_v08<T, A>
Source§impl<T, A> PartialOrd for GrayAlpha_v08<T, A>where
T: PartialOrd,
A: PartialOrd,
impl<T, A> PartialOrd for GrayAlpha_v08<T, A>where
T: PartialOrd,
A: PartialOrd,
Source§impl<T> Sub<T> for GrayAlpha_v08<T>
px - 1
impl<T> Sub<T> for GrayAlpha_v08<T>
px - 1
Source§impl<T, A> Sub for GrayAlpha_v08<T, A>
px - px
impl<T, A> Sub for GrayAlpha_v08<T, A>
px - px
Source§impl<T> SubAssign<T> for GrayAlpha_v08<T>
px - 1
impl<T> SubAssign<T> for GrayAlpha_v08<T>
px - 1
Source§fn sub_assign(&mut self, r: T)
fn sub_assign(&mut self, r: T)
Performs the
-=
operation. Read moreSource§impl<T, A> SubAssign for GrayAlpha_v08<T, A>
px - px
impl<T, A> SubAssign for GrayAlpha_v08<T, A>
px - px
Source§fn sub_assign(&mut self, other: GrayAlpha_v08<T, A>)
fn sub_assign(&mut self, other: GrayAlpha_v08<T, A>)
Performs the
-=
operation. Read moreSource§impl<T, A> Sum for GrayAlpha_v08<T, A>
impl<T, A> Sum for GrayAlpha_v08<T, A>
Source§fn sum<I>(iter: I) -> GrayAlpha_v08<T, A>where
I: Iterator<Item = GrayAlpha_v08<T, A>>,
fn sum<I>(iter: I) -> GrayAlpha_v08<T, A>where
I: Iterator<Item = GrayAlpha_v08<T, A>>,
Takes an iterator and generates
Self
from the elements by “summing up”
the items.Source§impl<T> Zeroable for GrayAlpha_v08<T>where
T: Zeroable,
impl<T> Zeroable for GrayAlpha_v08<T>where
T: Zeroable,
impl<T, A> Copy for GrayAlpha_v08<T, A>
impl<T, A> Eq for GrayAlpha_v08<T, A>
impl<T> Pod for GrayAlpha_v08<T>where
T: Pod,
impl<T, A> StructuralPartialEq for GrayAlpha_v08<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for GrayAlpha_v08<T, A>
impl<T, A> RefUnwindSafe for GrayAlpha_v08<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for GrayAlpha_v08<T, A>
impl<T, A> Sync for GrayAlpha_v08<T, A>
impl<T, A> Unpin for GrayAlpha_v08<T, A>
impl<T, A> UnwindSafe for GrayAlpha_v08<T, A>where
T: UnwindSafe,
A: 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
.