Struct lodepng::RGBA
[−]
[src]
#[repr(C)]pub struct RGBA<ComponentType, AlphaComponentType = ComponentType> { pub r: ComponentType, pub g: ComponentType, pub b: ComponentType, pub a: AlphaComponentType, }
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, T> where
T: Clone,
[src]
T: Clone,
impl<T> RGBA<T, T> where
T: Clone,
[src]
T: Clone,
impl<T, A> RGBA<T, A> where
T: Clone,
[src]
T: Clone,
impl<T, A> RGBA<T, A>
[src]
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
A: Clone,
T: Copy,
[src]
A: Clone,
T: Copy,
fn map_rgb<F, U, B>(&self, f: F) -> RGBA<U, B> where
B: From<A> + Clone,
F: FnMut(T) -> U,
U: Clone,
[src]
B: From<A> + Clone,
F: FnMut(T) -> U,
U: Clone,
Create new RGBA with the same alpha value, but different RGB values
Trait Implementations
impl<T> ComponentSlice<T> for RGBA<T, T>
[src]
impl<ComponentType, AlphaComponentType> Ord for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Ord,
ComponentType: Ord,
[src]
AlphaComponentType: Ord,
ComponentType: Ord,
impl<ComponentType, AlphaComponentType> Copy for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Copy,
ComponentType: Copy,
[src]
AlphaComponentType: Copy,
ComponentType: Copy,
impl<ComponentType, AlphaComponentType> Hash for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Hash,
ComponentType: Hash,
[src]
AlphaComponentType: Hash,
ComponentType: Hash,
fn hash<__HComponentTypeAlphaComponentType>(
&self,
__arg_0: &mut __HComponentTypeAlphaComponentType
) where
__HComponentTypeAlphaComponentType: Hasher,
[src]
&self,
__arg_0: &mut __HComponentTypeAlphaComponentType
) where
__HComponentTypeAlphaComponentType: Hasher,
impl<ComponentType, AlphaComponentType> Clone for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Clone,
ComponentType: Clone,
[src]
AlphaComponentType: Clone,
ComponentType: Clone,
fn clone(&self) -> RGBA<ComponentType, AlphaComponentType>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<ComponentType, AlphaComponentType> Eq for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Eq,
ComponentType: Eq,
[src]
AlphaComponentType: Eq,
ComponentType: Eq,
impl<T> From<BGRA<T, T>> for RGBA<T, T>
[src]
impl From<RGBA<u16, u16>> for RGBA<f32, f32>
[src]
impl<T> From<BGR<T>> for RGBA<T, u8> where
T: Copy,
[src]
T: Copy,
Assumes 255 is opaque
impl From<RGBA<i16, i16>> for RGBA<f32, f32>
[src]
impl From<RGBA<u8, u8>> for RGBA<f64, f64>
[src]
impl From<RGBA<u16, u16>> for RGBA<i32, i32>
[src]
impl From<RGBA<u8, u8>> for RGBA<f32, f32>
[src]
impl From<RGBA<f32, f32>> for RGBA<f64, f64>
[src]
impl From<RGBA<i16, i16>> for RGBA<f64, f64>
[src]
impl From<RGBA<i32, i32>> for RGBA<f64, f64>
[src]
impl<T> From<RGB<T>> for RGBA<T, u8> where
T: Copy,
[src]
T: Copy,
Assumes 255 is opaque
impl From<RGBA<u16, u16>> for RGBA<f64, f64>
[src]
impl<ComponentType, AlphaComponentType> PartialEq<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: PartialEq<AlphaComponentType>,
ComponentType: PartialEq<ComponentType>,
[src]
AlphaComponentType: PartialEq<AlphaComponentType>,
ComponentType: PartialEq<ComponentType>,
fn eq(&self, __arg_0: &RGBA<ComponentType, AlphaComponentType>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RGBA<ComponentType, AlphaComponentType>) -> bool
[src]
This method tests for !=
.
impl<T> Add<T> for RGBA<T, T> where
T: Copy + Add<T, Output = T> + Clone + Add<T>,
[src]
T: Copy + Add<T, Output = T> + Clone + Add<T>,
impl<T> Add<RGBA<T, T>> for RGBA<T, T> where
T: Add<T>,
[src]
T: Add<T>,
type Output = RGBA<<T as Add<T>>::Output, <T as Add<T>>::Output>
fn add(self, other: RGBA<T, T>) -> <RGBA<T, T> as Add<RGBA<T, T>>>::Output
[src]
impl<ComponentType, AlphaComponentType> Debug for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Debug,
ComponentType: Debug,
[src]
AlphaComponentType: Debug,
ComponentType: Debug,
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl<T> Mul<T> for RGBA<T, T> where
T: Copy + Mul<T, Output = T> + Clone + Mul<T>,
[src]
T: Copy + Mul<T, Output = T> + Clone + Mul<T>,
impl<T> FromIterator<T> for RGBA<T, T>
[src]
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<T, A> Display for RGBA<T, A> where
A: Display,
T: Display,
[src]
A: Display,
T: Display,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter. Read more
impl<T> Sub<RGBA<T, T>> for RGBA<T, T> where
T: Sub<T>,
[src]
T: Sub<T>,
type Output = RGBA<<T as Sub<T>>::Output, <T as Sub<T>>::Output>
fn sub(self, other: RGBA<T, T>) -> <RGBA<T, T> as Sub<RGBA<T, T>>>::Output
[src]
impl<ComponentType, AlphaComponentType> Default for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: Default,
ComponentType: Default,
[src]
AlphaComponentType: Default,
ComponentType: Default,
fn default() -> RGBA<ComponentType, AlphaComponentType>
[src]
Returns the "default value" for a type. Read more
impl<T, B> ComponentMap<RGBA<B, B>, T, B> for RGBA<T, T> where
T: Copy,
[src]
T: Copy,
impl<ComponentType, AlphaComponentType> PartialOrd<RGBA<ComponentType, AlphaComponentType>> for RGBA<ComponentType, AlphaComponentType> where
AlphaComponentType: PartialOrd<AlphaComponentType>,
ComponentType: PartialOrd<ComponentType>,
[src]
AlphaComponentType: PartialOrd<AlphaComponentType>,
ComponentType: PartialOrd<ComponentType>,
fn partial_cmp(
&self,
__arg_0: &RGBA<ComponentType, AlphaComponentType>
) -> Option<Ordering>
[src]
&self,
__arg_0: &RGBA<ComponentType, AlphaComponentType>
) -> Option<Ordering>