Struct resize::px::RGBA [−][src]
The RGBA pixel
The component type can be u8
(aliased as RGBA8
), u16
(aliased as RGBA16
),
or any other type (but simple copyable types are recommended.)
You can specify a different type for alpha, but it’s only for special cases
(e.g. if you use a newtype like RGBA<LinearLight<u16>, u16>
).
Fields
r: ComponentType
Red
g: ComponentType
Green
b: ComponentType
Blue
a: AlphaComponentType
Alpha
Implementations
impl<T> RGBA<T, T>
[src]
pub const fn new(r: T, g: T, b: T, a: T) -> RGBA<T, T>
[src]
Convenience function for creating a new pixel The order of arguments is R,G,B,A
impl<T, A> RGBA<T, A>
[src]
pub const fn new_alpha(r: T, g: T, b: T, a: A) -> RGBA<T, A>
[src]
Convenience function for creating a new pixel The order of arguments is R,G,B,A
impl<T, A> RGBA<T, A>
[src]
pub fn rgb_mut(&mut self) -> &mut RGB<T>
[src]
Provide a mutable view of only RGB components (leaving out alpha). Useful to change color without changing opacity.
impl<T, A> RGBA<T, A> where
T: Clone,
[src]
T: Clone,
pub fn rgb(&self) -> RGB<T>
[src]
Copy RGB components out of the RGBA struct
Note: you can use .into()
to convert between other types
impl<T> RGBA<T, T> where
T: Clone,
[src]
T: Clone,
impl<T, A> RGBA<T, A> where
T: Clone,
[src]
T: Clone,
pub fn bgr(&self) -> BGR<T>
[src]
Copy RGB components out of the RGBA struct
Note: you can use .into()
to convert between other types
impl<T, A> RGBA<T, A> where
T: Copy,
A: Clone,
[src]
T: Copy,
A: Clone,
pub fn map_rgb<F, U, B>(&self, f: F) -> RGBA<U, B> where
F: FnMut(T) -> U,
B: From<A> + Clone,
U: Clone,
[src]
F: FnMut(T) -> U,
B: From<A> + Clone,
U: Clone,
Create new RGBA with the same alpha value, but different RGB values
pub fn alpha(&self, a: A) -> RGBA<T, A>
[src]
Create a new RGBA with the new alpha value, but same RGB values
pub fn map_alpha<F, B>(&self, f: F) -> RGBA<T, B> where
F: FnOnce(A) -> B,
[src]
F: FnOnce(A) -> B,
Create a new RGBA with a new alpha value created by the callback. Allows changing of the type used for the alpha channel.
Trait Implementations
impl<T, A> Add<RGBA<T, A>> for RGBA<T, A> where
T: Add<T>,
A: Add<A>,
[src]
T: Add<T>,
A: Add<A>,
px + px
type Output = RGBA<<T as Add<T>>::Output, <A as Add<A>>::Output>
The resulting type after applying the +
operator.
pub fn add(self, other: RGBA<T, A>) -> <RGBA<T, A> as Add<RGBA<T, A>>>::Output
[src]
impl<T> Add<T> for RGBA<T, T> where
T: Copy + Add<T, Output = T>,
[src]
T: Copy + Add<T, Output = T>,
px + 1
type Output = RGBA<T, T>
The resulting type after applying the +
operator.
pub fn add(self, r: T) -> <RGBA<T, T> as Add<T>>::Output
[src]
impl<T, A> AddAssign<RGBA<T, A>> for RGBA<T, A> where
T: Add<T, Output = T> + Copy,
A: Add<A, Output = A> + Copy,
[src]
T: Add<T, Output = T> + Copy,
A: Add<A, Output = A> + Copy,
px + px
pub fn add_assign(&mut self, other: RGBA<T, A>)
[src]
impl<T> AddAssign<T> for RGBA<T, T> where
T: Copy + Add<T, Output = T>,
[src]
T: Copy + Add<T, Output = T>,
px + 1
pub fn add_assign(&mut self, r: T)
[src]
impl<T> AsMut<[T]> for RGBA<T, T>
[src]
impl<T> AsRef<[T]> for RGBA<T, T>
[src]
impl<ComponentType, AlphaComponentType> Clone for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Clone,
AlphaComponentType: Clone,
[src]
ComponentType: Clone,
AlphaComponentType: Clone,
pub fn clone(&self) -> RGBA<ComponentType, AlphaComponentType>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T, T> where
T: Copy,
[src]
T: Copy,
impl<T> ComponentSlice<T> for RGBA<T, T>
[src]
impl<ComponentType, AlphaComponentType> Copy for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Copy,
AlphaComponentType: Copy,
[src]
ComponentType: Copy,
AlphaComponentType: Copy,
impl<ComponentType, AlphaComponentType> Debug for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Debug,
AlphaComponentType: Debug,
[src]
ComponentType: Debug,
AlphaComponentType: Debug,
impl<ComponentType, AlphaComponentType> Default for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Default,
AlphaComponentType: Default,
[src]
ComponentType: Default,
AlphaComponentType: Default,
impl<T, A> Display for RGBA<T, A> where
T: Display,
A: Display,
[src]
T: Display,
A: Display,
impl<T> Div<T> for RGBA<T, T> where
T: Copy + Div<T, Output = T>,
[src]
T: Copy + Div<T, Output = T>,
px / 1
type Output = RGBA<T, T>
The resulting type after applying the /
operator.
pub fn div(self, r: T) -> <RGBA<T, T> as Div<T>>::Output
[src]
impl<T> DivAssign<T> for RGBA<T, T> where
T: Copy + Div<T, Output = T>,
[src]
T: Copy + Div<T, Output = T>,
px * 1
pub fn div_assign(&mut self, r: T)
[src]
impl<ComponentType, AlphaComponentType> Eq for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Eq,
AlphaComponentType: Eq,
[src]
ComponentType: Eq,
AlphaComponentType: Eq,
impl<T> From<[T; 4]> for RGBA<T, T> where
T: Copy,
[src]
T: Copy,
impl<T, A> From<(T, T, T, A)> for RGBA<T, A>
[src]
impl<T> From<BGR<T>> for RGBA<T, u8> where
T: Copy,
[src]
T: Copy,
Assumes 255 is opaque
impl<T> From<BGR<T>> for RGBA<T, u16> where
T: Copy,
[src]
T: Copy,
Assumes 65535 is opaque
impl<T> From<BGRA<T, T>> for RGBA<T, T>
[src]
impl<T, A> From<GrayAlpha<T, A>> for RGBA<T, A> where
T: Clone,
[src]
T: Clone,
impl<T> From<RGB<T>> for RGBA<T, u16> where
T: Copy,
[src]
T: Copy,
Assumes 65535 is opaque
impl<T> From<RGB<T>> for RGBA<T, u8> where
T: Copy,
[src]
T: Copy,
Assumes 255 is opaque
impl From<RGBA<f32, f32>> for RGBA<f64, f64>
[src]
impl From<RGBA<i16, i16>> for RGBA<f32, f32>
[src]
impl From<RGBA<i16, i16>> for RGBA<f64, f64>
[src]
impl From<RGBA<i32, i32>> for RGBA<f64, f64>
[src]
impl From<RGBA<u16, u16>> for RGBA<f64, f64>
[src]
impl From<RGBA<u16, u16>> for RGBA<f32, f32>
[src]
impl From<RGBA<u16, u16>> for RGBA<i32, i32>
[src]
impl From<RGBA<u8, u8>> for RGBA<f32, f32>
[src]
impl From<RGBA<u8, u8>> for RGBA<f64, f64>
[src]
impl<T> FromIterator<T> for RGBA<T, T>
[src]
pub fn from_iter<I>(into_iter: I) -> RGBA<T, T> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Takes exactly 4 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
impl<ComponentType, AlphaComponentType> Hash for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Hash,
AlphaComponentType: Hash,
[src]
ComponentType: Hash,
AlphaComponentType: Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Into<[T; 4]> for RGBA<T, T>
[src]
impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>
[src]
impl<T> Mul<T> for RGBA<T, T> where
T: Copy + Mul<T, Output = T>,
[src]
T: Copy + Mul<T, Output = T>,
px * 1
type Output = RGBA<T, T>
The resulting type after applying the *
operator.
pub fn mul(self, r: T) -> <RGBA<T, T> as Mul<T>>::Output
[src]
impl<T> MulAssign<T> for RGBA<T, T> where
T: Copy + Mul<T, Output = T>,
[src]
T: Copy + Mul<T, Output = T>,
px * 1
pub fn mul_assign(&mut self, r: T)
[src]
impl<ComponentType, AlphaComponentType> Ord for RGBA<ComponentType, AlphaComponentType> where
ComponentType: Ord,
AlphaComponentType: Ord,
[src]
ComponentType: Ord,
AlphaComponentType: Ord,
pub fn cmp(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<ComponentType, AlphaComponentType> PartialEq<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType> where
ComponentType: PartialEq<ComponentType>,
AlphaComponentType: PartialEq<AlphaComponentType>,
[src]
ComponentType: PartialEq<ComponentType>,
AlphaComponentType: PartialEq<AlphaComponentType>,
pub fn eq(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool
[src]
pub fn ne(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool
[src]
impl<ComponentType, AlphaComponentType> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType> where
ComponentType: PartialOrd<ComponentType>,
AlphaComponentType: PartialOrd<AlphaComponentType>,
[src]
ComponentType: PartialOrd<ComponentType>,
AlphaComponentType: PartialOrd<AlphaComponentType>,
pub fn partial_cmp(
&self,
other: &RGBA<ComponentType, AlphaComponentType>
) -> Option<Ordering>
[src]
&self,
other: &RGBA<ComponentType, AlphaComponentType>
) -> Option<Ordering>
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T, A> Pod for RGBA<T, A> where
T: Pod,
A: Pod,
[src]
T: Pod,
A: Pod,
impl<ComponentType, AlphaComponentType> StructuralEq for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType, AlphaComponentType> StructuralPartialEq for RGBA<ComponentType, AlphaComponentType>
[src]
impl<T, A> Sub<RGBA<T, A>> for RGBA<T, A> where
T: Sub<T>,
A: Sub<A>,
[src]
T: Sub<T>,
A: Sub<A>,
px - px
type Output = RGBA<<T as Sub<T>>::Output, <A as Sub<A>>::Output>
The resulting type after applying the -
operator.
pub fn sub(self, other: RGBA<T, A>) -> <RGBA<T, A> as Sub<RGBA<T, A>>>::Output
[src]
impl<T> Sub<T> for RGBA<T, T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
px - 1
type Output = RGBA<<T as Sub<T>>::Output, <T as Sub<T>>::Output>
The resulting type after applying the -
operator.
pub fn sub(self, r: T) -> <RGBA<T, T> as Sub<T>>::Output
[src]
impl<T, A> SubAssign<RGBA<T, A>> for RGBA<T, A> where
T: Sub<T, Output = T> + Copy,
A: Sub<A, Output = A> + Copy,
[src]
T: Sub<T, Output = T> + Copy,
A: Sub<A, Output = A> + Copy,
px - px
pub fn sub_assign(&mut self, other: RGBA<T, A>)
[src]
impl<T> SubAssign<T> for RGBA<T, T> where
T: Copy + Sub<T, Output = T>,
[src]
T: Copy + Sub<T, Output = T>,
px - 1
pub fn sub_assign(&mut self, r: T)
[src]
impl<T, A> Sum<RGBA<T, A>> for RGBA<T, A> where
T: Default + Add<T, Output = T>,
A: Default + Add<A, Output = A>,
[src]
T: Default + Add<T, Output = T>,
A: Default + Add<A, Output = A>,
impl<T, A> Zeroable for RGBA<T, A> where
T: Zeroable,
A: Zeroable,
[src]
T: Zeroable,
A: Zeroable,
Auto Trait Implementations
impl<ComponentType, AlphaComponentType> RefUnwindSafe for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: RefUnwindSafe,
ComponentType: RefUnwindSafe,
AlphaComponentType: RefUnwindSafe,
ComponentType: RefUnwindSafe,
impl<ComponentType, AlphaComponentType> Send for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Send,
ComponentType: Send,
AlphaComponentType: Send,
ComponentType: Send,
impl<ComponentType, AlphaComponentType> Sync for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Sync,
ComponentType: Sync,
AlphaComponentType: Sync,
ComponentType: Sync,
impl<ComponentType, AlphaComponentType> Unpin for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Unpin,
ComponentType: Unpin,
AlphaComponentType: Unpin,
ComponentType: Unpin,
impl<ComponentType, AlphaComponentType> UnwindSafe for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: UnwindSafe,
ComponentType: UnwindSafe,
AlphaComponentType: UnwindSafe,
ComponentType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
[src]
T: Hash,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,