Struct lodepng::RGB [−][src]
#[repr(C)]pub struct RGB<ComponentType> { pub r: ComponentType, pub g: ComponentType, pub b: ComponentType, }
The RGB pixel
The component type can be u8
(aliased as RGB8
), u16
(aliased as RGB16
),
or any other type (but simple copyable types are recommended.)
Fields
r: ComponentType
Red
g: ComponentType
Green
b: ComponentType
Blue
Methods
impl<T> RGB<T> where
T: Clone,
[src]
impl<T> RGB<T> where
T: Clone,
pub fn new(r: T, g: T, b: T) -> RGB<T>
[src]
pub fn new(r: T, g: T, b: T) -> RGB<T>
Convenience function for creating a new pixel
ⓘImportant traits for Cloned<I>pub fn iter(&self) -> Cloned<Iter<T>>
[src]
pub fn iter(&self) -> Cloned<Iter<T>>
Iterate over color components (R, G, and B)
pub fn alpha(&self, a: T) -> RGBA<T, T>
[src]
pub fn alpha(&self, a: T) -> RGBA<T, T>
pub fn new_alpha<A>(&self, a: A) -> RGBA<T, A>
[src]
pub fn new_alpha<A>(&self, a: A) -> RGBA<T, A>
Trait Implementations
impl<ComponentType> Copy for RGB<ComponentType> where
ComponentType: Copy,
[src]
impl<ComponentType> Copy for RGB<ComponentType> where
ComponentType: Copy,
impl<ComponentType> Ord for RGB<ComponentType> where
ComponentType: Ord,
[src]
impl<ComponentType> Ord for RGB<ComponentType> where
ComponentType: Ord,
fn cmp(&self, other: &RGB<ComponentType>) -> Ordering
[src]
fn cmp(&self, other: &RGB<ComponentType>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T> Mul<T> for RGB<T> where
T: Copy + Mul<T, Output = T> + Clone + Mul<T>,
[src]
impl<T> Mul<T> for RGB<T> where
T: Copy + Mul<T, Output = T> + Clone + Mul<T>,
px * 1
type Output = RGB<T>
The resulting type after applying the *
operator.
fn mul(self, r: T) -> <RGB<T> as Mul<T>>::Output
[src]
fn mul(self, r: T) -> <RGB<T> as Mul<T>>::Output
Performs the *
operation.
impl<T> AsMut<[T]> for RGB<T>
[src]
impl<T> AsMut<[T]> for RGB<T>
impl<ComponentType> Debug for RGB<ComponentType> where
ComponentType: Debug,
[src]
impl<ComponentType> Debug for RGB<ComponentType> where
ComponentType: Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<ComponentType> Default for RGB<ComponentType> where
ComponentType: Default,
[src]
impl<ComponentType> Default for RGB<ComponentType> where
ComponentType: Default,
impl<T> Display for RGB<T> where
T: Display,
[src]
impl<T> Display for RGB<T> where
T: Display,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<ComponentType> Clone for RGB<ComponentType> where
ComponentType: Clone,
[src]
impl<ComponentType> Clone for RGB<ComponentType> where
ComponentType: Clone,
fn clone(&self) -> RGB<ComponentType>
[src]
fn clone(&self) -> RGB<ComponentType>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T> Sub<RGB<T>> for RGB<T> where
T: Sub<T>,
[src]
impl<T> Sub<RGB<T>> for RGB<T> where
T: Sub<T>,
px - px
type Output = RGB<<T as Sub<T>>::Output>
The resulting type after applying the -
operator.
fn sub(self, other: RGB<T>) -> <RGB<T> as Sub<RGB<T>>>::Output
[src]
fn sub(self, other: RGB<T>) -> <RGB<T> as Sub<RGB<T>>>::Output
Performs the -
operation.
impl<T> FromIterator<T> for RGB<T>
[src]
impl<T> FromIterator<T> for RGB<T>
fn from_iter<I>(into_iter: I) -> RGB<T> where
I: IntoIterator<Item = T>,
[src]
fn from_iter<I>(into_iter: I) -> RGB<T> where
I: IntoIterator<Item = T>,
Takes exactly 3 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.
impl<ComponentType> Hash for RGB<ComponentType> where
ComponentType: Hash,
[src]
impl<ComponentType> Hash for RGB<ComponentType> where
ComponentType: Hash,
fn hash<__HComponentType>(&self, state: &mut __HComponentType) where
__HComponentType: Hasher,
[src]
fn hash<__HComponentType>(&self, state: &mut __HComponentType) where
__HComponentType: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<ComponentType> PartialOrd<RGB<ComponentType>> for RGB<ComponentType> where
ComponentType: PartialOrd<ComponentType>,
[src]
impl<ComponentType> PartialOrd<RGB<ComponentType>> for RGB<ComponentType> where
ComponentType: PartialOrd<ComponentType>,
fn partial_cmp(&self, other: &RGB<ComponentType>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &RGB<ComponentType>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &RGB<ComponentType>) -> bool
[src]
fn lt(&self, other: &RGB<ComponentType>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &RGB<ComponentType>) -> bool
[src]
fn le(&self, other: &RGB<ComponentType>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &RGB<ComponentType>) -> bool
[src]
fn gt(&self, other: &RGB<ComponentType>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &RGB<ComponentType>) -> bool
[src]
fn ge(&self, other: &RGB<ComponentType>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> Add<RGB<T>> for RGB<T> where
T: Add<T>,
[src]
impl<T> Add<RGB<T>> for RGB<T> where
T: Add<T>,
px + px
type Output = RGB<<T as Add<T>>::Output>
The resulting type after applying the +
operator.
fn add(self, other: RGB<T>) -> <RGB<T> as Add<RGB<T>>>::Output
[src]
fn add(self, other: RGB<T>) -> <RGB<T> as Add<RGB<T>>>::Output
Performs the +
operation.
impl<T> Add<T> for RGB<T> where
T: Copy + Add<T, Output = T> + Clone + Add<T>,
[src]
impl<T> Add<T> for RGB<T> where
T: Copy + Add<T, Output = T> + Clone + Add<T>,
px + 1
type Output = RGB<T>
The resulting type after applying the +
operator.
fn add(self, r: T) -> <RGB<T> as Add<T>>::Output
[src]
fn add(self, r: T) -> <RGB<T> as Add<T>>::Output
Performs the +
operation.
impl<T, B> ComponentMap<RGB<B>, T, B> for RGB<T> where
T: Copy,
[src]
impl<T, B> ComponentMap<RGB<B>, T, B> for RGB<T> where
T: Copy,
fn map<F>(&self, f: F) -> RGB<B> where
F: FnMut(T) -> B,
[src]
fn map<F>(&self, f: F) -> RGB<B> where
F: FnMut(T) -> B,
Convenience function (equivalent of self.iter().map().collect()
) for applying the same formula to every component. Read more
impl<T> Into<(T, T, T)> for RGB<T>
[src]
impl<T> Into<(T, T, T)> for RGB<T>
impl<T> From<RGB<T>> for BGR<T>
[src]
impl<T> From<RGB<T>> for BGR<T>
impl From<RGB<u16>> for RGB<i32>
[src]
impl From<RGB<u16>> for RGB<i32>
impl<T> From<RGB<T>> for RGBA<T, u16> where
T: Copy,
[src]
impl<T> From<RGB<T>> for RGBA<T, u16> where
T: Copy,
Assumes 65535 is opaque
impl From<RGB<u8>> for RGB<i16>
[src]
impl From<RGB<u8>> for RGB<i16>
impl From<RGB<f32>> for RGB<f64>
[src]
impl From<RGB<f32>> for RGB<f64>
impl From<RGB<i16>> for RGB<f32>
[src]
impl From<RGB<i16>> for RGB<f32>
impl From<RGB<u8>> for RGB<f32>
[src]
impl From<RGB<u8>> for RGB<f32>
impl<T> From<RGB<T>> for RGBA<T, u8> where
T: Copy,
[src]
impl<T> From<RGB<T>> for RGBA<T, u8> where
T: Copy,
Assumes 255 is opaque
impl From<RGB<u16>> for RGB<f32>
[src]
impl From<RGB<u16>> for RGB<f32>
impl<T> From<(T, T, T)> for RGB<T>
[src]
impl<T> From<(T, T, T)> for RGB<T>
impl From<RGB<i32>> for RGB<f64>
[src]
impl From<RGB<i32>> for RGB<f64>
impl From<RGB<i16>> for RGB<f64>
[src]
impl From<RGB<i16>> for RGB<f64>
impl<T> From<RGB<T>> for BGRA<T, u16> where
T: Copy,
[src]
impl<T> From<RGB<T>> for BGRA<T, u16> where
T: Copy,
Assumes 255 is opaque
impl From<RGB<u8>> for RGB<f64>
[src]
impl From<RGB<u8>> for RGB<f64>
impl<T> From<RGB<T>> for BGRA<T, u8> where
T: Copy,
[src]
impl<T> From<RGB<T>> for BGRA<T, u8> where
T: Copy,
Assumes 255 is opaque
impl From<RGB<u16>> for RGB<f64>
[src]
impl From<RGB<u16>> for RGB<f64>
impl<T> From<Gray<T>> for RGB<T> where
T: Clone,
[src]
impl<T> From<Gray<T>> for RGB<T> where
T: Clone,
impl<T> From<BGR<T>> for RGB<T>
[src]
impl<T> From<BGR<T>> for RGB<T>
impl<T> ComponentSlice<T> for RGB<T>
[src]
impl<T> ComponentSlice<T> for RGB<T>
fn as_slice(&self) -> &[T]
[src]
fn as_slice(&self) -> &[T]
The components interpreted as an array, e.g. one RGB
expands to 3 elements. Read more
fn as_mut_slice(&mut self) -> &mut [T]
[src]
fn as_mut_slice(&mut self) -> &mut [T]
impl<ComponentType> PartialEq<RGB<ComponentType>> for RGB<ComponentType> where
ComponentType: PartialEq<ComponentType>,
[src]
impl<ComponentType> PartialEq<RGB<ComponentType>> for RGB<ComponentType> where
ComponentType: PartialEq<ComponentType>,
fn eq(&self, other: &RGB<ComponentType>) -> bool
[src]
fn eq(&self, other: &RGB<ComponentType>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &RGB<ComponentType>) -> bool
[src]
fn ne(&self, other: &RGB<ComponentType>) -> bool
This method tests for !=
.
impl<ComponentType> Eq for RGB<ComponentType> where
ComponentType: Eq,
[src]
impl<ComponentType> Eq for RGB<ComponentType> where
ComponentType: Eq,
impl<T> AsRef<[T]> for RGB<T>
[src]
impl<T> AsRef<[T]> for RGB<T>