[−][src]Struct rgb::RGBA
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
Methods
impl<T> RGBA<T>
[src]
impl<T> RGBA<T>
pub fn new(r: T, g: T, b: T, a: T) -> Self | [src] |
Convenience function for creating a new pixel The order of arguments is R,G,B,A
impl<T, A> RGBA<T, A>
[src]
impl<T, A> RGBA<T, A>
pub fn new_alpha(r: T, g: T, b: T, a: A) -> Self | [src] |
Convenience function for creating a new pixel The order of arguments is R,G,B,A
impl<T: Clone> RGBA<T>
[src]
impl<T: Clone> RGBA<T>
impl<T: Clone, A> RGBA<T, A>
[src]
impl<T: Clone, A> RGBA<T, A>
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, A> RGBA<T, A>
[src]
impl<T, A> RGBA<T, A>
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: Copy, A: Clone> RGBA<T, A>
[src]
impl<T: Copy, A: Clone> RGBA<T, A>
pub fn map_rgb<F, U, B>(&self, f: F) -> RGBA<U, B> where | [src] |
Create new RGBA with the same alpha value, but different RGB values
Trait Implementations
impl<T> ComponentSlice<T> for RGBA<T>
[src]
impl<T> ComponentSlice<T> for RGBA<T>
fn as_slice(&self) -> &[T] | [src] |
fn as_mut_slice(&mut self) -> &mut [T] | [src] |
impl<T: Copy, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T>
[src]
impl<T: Copy, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T>
impl<T> AsPixels<RGBA<T, T>> for [T]
[src]
impl<T> AsPixels<RGBA<T, T>> for [T]
impl<ComponentType: Copy, AlphaComponentType: Copy> Copy for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Copy, AlphaComponentType: Copy> Copy for RGBA<ComponentType, AlphaComponentType>
impl<T: Display, A: Display> Display for RGBA<T, A>
[src]
impl<T: Display, A: Display> Display for RGBA<T, A>
impl<ComponentType: Debug, AlphaComponentType: Debug> Debug for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Debug, AlphaComponentType: Debug> Debug for RGBA<ComponentType, AlphaComponentType>
impl<T: Sub, A: Sub> Sub<RGBA<T, A>> for RGBA<T, A>
[src]
impl<T: Sub, A: Sub> Sub<RGBA<T, A>> for RGBA<T, A>
px - px
type Output = RGBA<<T as Sub>::Output, <A as Sub>::Output>
The resulting type after applying the -
operator.
fn sub(self, other: RGBA<T, A>) -> Self::Output | [src] |
impl<ComponentType: PartialEq, AlphaComponentType: PartialEq> PartialEq<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: PartialEq, AlphaComponentType: PartialEq> PartialEq<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
fn eq(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
fn ne(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
impl<ComponentType: Eq, AlphaComponentType: Eq> Eq for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Eq, AlphaComponentType: Eq> Eq for RGBA<ComponentType, AlphaComponentType>
impl<ComponentType: Ord, AlphaComponentType: Ord> Ord for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Ord, AlphaComponentType: Ord> Ord for RGBA<ComponentType, AlphaComponentType>
fn cmp(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> Ordering | [src] |
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
impl<ComponentType: PartialOrd, AlphaComponentType: PartialOrd> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: PartialOrd, AlphaComponentType: PartialOrd> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType>
fn partial_cmp( | [src] |
fn lt(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
fn le(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
fn gt(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
fn ge(&self, other: &RGBA<ComponentType, AlphaComponentType>) -> bool | [src] |
impl<ComponentType: Hash, AlphaComponentType: Hash> Hash for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Hash, AlphaComponentType: Hash> Hash for RGBA<ComponentType, AlphaComponentType>
fn hash<__HComponentTypeAlphaComponentType: Hasher>( | [src] |
fn hash_slice<H>(data: &[Self], state: &mut H) where | 1.3.0 [src] |
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Copy> From<RGB<T>> for RGBA<T, u8>
[src]
impl<T: Copy> From<RGB<T>> for RGBA<T, u8>
Assumes 255 is opaque
impl<T: Copy> From<RGB<T>> for RGBA<T, u16>
[src]
impl<T: Copy> From<RGB<T>> for RGBA<T, u16>
Assumes 65535 is opaque
impl<T: Copy> From<BGR<T>> for RGBA<T, u8>
[src]
impl<T: Copy> From<BGR<T>> for RGBA<T, u8>
Assumes 255 is opaque
impl<T: Copy> From<BGR<T>> for RGBA<T, u16>
[src]
impl<T: Copy> From<BGR<T>> for RGBA<T, u16>
Assumes 255 is opaque
impl<T: Copy> From<[T; 4]> for RGBA<T>
[src]
impl<T: Copy> From<[T; 4]> for RGBA<T>
impl<T, A> From<(T, T, T, A)> for RGBA<T, A>
[src]
impl<T, A> From<(T, T, T, A)> for RGBA<T, A>
impl From<RGBA<u16, u16>> for RGBA<i32>
[src]
impl From<RGBA<u16, u16>> for RGBA<i32>
impl From<RGBA<u8, u8>> for RGBA<f32>
[src]
impl From<RGBA<u8, u8>> for RGBA<f32>
impl From<RGBA<u8, u8>> for RGBA<f64>
[src]
impl From<RGBA<u8, u8>> for RGBA<f64>
impl From<RGBA<u16, u16>> for RGBA<f32>
[src]
impl From<RGBA<u16, u16>> for RGBA<f32>
impl From<RGBA<u16, u16>> for RGBA<f64>
[src]
impl From<RGBA<u16, u16>> for RGBA<f64>
impl From<RGBA<i16, i16>> for RGBA<f32>
[src]
impl From<RGBA<i16, i16>> for RGBA<f32>
impl From<RGBA<i16, i16>> for RGBA<f64>
[src]
impl From<RGBA<i16, i16>> for RGBA<f64>
impl From<RGBA<i32, i32>> for RGBA<f64>
[src]
impl From<RGBA<i32, i32>> for RGBA<f64>
impl From<RGBA<f32, f32>> for RGBA<f64>
[src]
impl From<RGBA<f32, f32>> for RGBA<f64>
impl<T: Clone, A> From<GrayAlpha<T, A>> for RGBA<T, A>
[src]
impl<T: Clone, A> From<GrayAlpha<T, A>> for RGBA<T, A>
impl<T> From<RGBA<T, T>> for BGRA<T>
[src]
impl<T> From<RGBA<T, T>> for BGRA<T>
impl<T> From<BGRA<T, T>> for RGBA<T>
[src]
impl<T> From<BGRA<T, T>> for RGBA<T>
impl<T: Add, A: Add> Add<RGBA<T, A>> for RGBA<T, A>
[src]
impl<T: Add, A: Add> Add<RGBA<T, A>> for RGBA<T, A>
px + px
type Output = RGBA<<T as Add>::Output, <A as Add>::Output>
The resulting type after applying the +
operator.
fn add(self, other: RGBA<T, A>) -> Self::Output | [src] |
impl<T: Clone + Copy + Add> Add<T> for RGBA<T> where
T: Add<Output = T>,
[src]
impl<T: Clone + Copy + Add> Add<T> for RGBA<T> where
T: Add<Output = T>,
px + 1
type Output = RGBA<T>
The resulting type after applying the +
operator.
fn add(self, r: T) -> Self::Output | [src] |
impl<T: Clone + Copy + Mul> Mul<T> for RGBA<T> where
T: Mul<Output = T>,
[src]
impl<T: Clone + Copy + Mul> Mul<T> for RGBA<T> where
T: Mul<Output = T>,
px * 1
type Output = RGBA<T>
The resulting type after applying the *
operator.
fn mul(self, r: T) -> Self::Output | [src] |
impl<T> FromIterator<T> for RGBA<T>
[src]
impl<T> FromIterator<T> for RGBA<T>
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self | [src] |
Takes exactly 4 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
impl<ComponentType: Clone, AlphaComponentType: Clone> Clone for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Clone, AlphaComponentType: Clone> Clone for RGBA<ComponentType, AlphaComponentType>
fn clone(&self) -> RGBA<ComponentType, AlphaComponentType> | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl<ComponentType: Default, AlphaComponentType: Default> Default for RGBA<ComponentType, AlphaComponentType>
[src]
impl<ComponentType: Default, AlphaComponentType: Default> Default for RGBA<ComponentType, AlphaComponentType>
impl<T> AsRef<[T]> for RGBA<T>
[src]
impl<T> AsRef<[T]> for RGBA<T>
impl<T> Into<[T; 4]> for RGBA<T>
[src]
impl<T> Into<[T; 4]> for RGBA<T>
impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>
[src]
impl<T, A> Into<(T, T, T, A)> for RGBA<T, A>
impl<T> AsMut<[T]> for RGBA<T>
[src]
impl<T> AsMut<[T]> for RGBA<T>
Auto Trait Implementations
impl<ComponentType, AlphaComponentType> Send for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Send,
ComponentType: Send,
impl<ComponentType, AlphaComponentType> Send for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Send,
ComponentType: Send,
impl<ComponentType, AlphaComponentType> Sync for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Sync,
ComponentType: Sync,
impl<ComponentType, AlphaComponentType> Sync for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Sync,
ComponentType: Sync,
Blanket Implementations
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |