Struct yuv::RGB[][src]

#[repr(C)]
pub struct RGB<ComponentType> { pub r: ComponentType, pub g: ComponentType, pub b: ComponentType, }
Expand description

An RGB pixel (from the rgb crate) 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

Implementations

impl<T> RGB<T>[src]

An RGB pixel (from the rgb crate)

pub const fn new(r: T, g: T, b: T) -> RGB<T>[src]

Convenience function for creating a new pixel The order of arguments is R,G,B

impl<T> RGB<T> where
    T: Clone
[src]

An RGB pixel (from the rgb crate)

pub fn iter(&self) -> Cloned<Iter<'_, T>>[src]

Iterate over color components (R, G, and B)

pub fn alpha(&self, a: T) -> RGBA<T, T>[src]

Convenience function for converting to RGBA

pub fn new_alpha<A>(&self, a: A) -> RGBA<T, A>[src]

Convenience function for converting to RGBA with alpha channel of a different type than type of the pixels

Trait Implementations

impl<T> Add<RGB<T>> for RGB<T> where
    T: Add<T>, 
[src]

px + px

type Output = RGB<<T as Add<T>>::Output>

The resulting type after applying the + operator.

pub fn add(self, other: RGB<T>) -> <RGB<T> as Add<RGB<T>>>::Output[src]

Performs the + operation. Read more

impl<T> Add<T> for RGB<T> where
    T: Copy + Add<T, Output = T>, 
[src]

px + 1

type Output = RGB<T>

The resulting type after applying the + operator.

pub fn add(self, r: T) -> <RGB<T> as Add<T>>::Output[src]

Performs the + operation. Read more

impl<T> AddAssign<RGB<T>> for RGB<T> where
    T: Add<T, Output = T> + Copy
[src]

px + px

pub fn add_assign(&mut self, other: RGB<T>)[src]

Performs the += operation. Read more

impl<T> AddAssign<T> for RGB<T> where
    T: Copy + Add<T, Output = T>, 
[src]

px + 1

pub fn add_assign(&mut self, r: T)[src]

Performs the += operation. Read more

impl<T> AsMut<[T]> for RGB<T>[src]

pub fn as_mut(&mut self) -> &mut [T][src]

Performs the conversion.

impl<T> AsRef<[T]> for RGB<T>[src]

pub fn as_ref(&self) -> &[T][src]

Performs the conversion.

impl<ComponentType> Clone for RGB<ComponentType> where
    ComponentType: Clone
[src]

pub fn clone(&self) -> RGB<ComponentType>[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<T, B> ComponentMap<RGB<B>, T, B> for RGB<T> where
    T: Copy
[src]

pub fn map<F>(&self, f: F) -> RGB<B> where
    F: FnMut(T) -> B, 
[src]

Convenience function (equivalent of self.iter().map().collect()) for applying the same formula to every component. Read more

impl<T> ComponentSlice<T> for RGB<T>[src]

pub fn as_slice(&self) -> &[T][src]

The components interpreted as an array, e.g. one RGB expands to 3 elements. Read more

pub fn as_mut_slice(&mut self) -> &mut [T][src]

The components interpreted as a mutable array, e.g. one RGB expands to 3 elements. Read more

impl<ComponentType> Debug for RGB<ComponentType> where
    ComponentType: Debug
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<ComponentType> Default for RGB<ComponentType> where
    ComponentType: Default
[src]

pub fn default() -> RGB<ComponentType>[src]

Returns the “default value” for a type. Read more

impl<T> Display for RGB<T> where
    T: Display
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<T> Div<T> for RGB<T> where
    T: Copy + Div<T, Output = T>, 
[src]

px / 1

type Output = RGB<T>

The resulting type after applying the / operator.

pub fn div(self, r: T) -> <RGB<T> as Div<T>>::Output[src]

Performs the / operation. Read more

impl<T> DivAssign<T> for RGB<T> where
    T: Copy + Div<T, Output = T>, 
[src]

px * 1

pub fn div_assign(&mut self, r: T)[src]

Performs the /= operation. Read more

impl<T> From<[T; 3]> for RGB<T> where
    T: Copy
[src]

pub fn from(other: [T; 3]) -> RGB<T>[src]

Performs the conversion.

impl<T> From<(T, T, T)> for RGB<T>[src]

pub fn from(other: (T, T, T)) -> RGB<T>[src]

Performs the conversion.

impl<T> From<BGR<T>> for RGB<T>[src]

pub fn from(other: BGR<T>) -> RGB<T>[src]

Performs the conversion.

impl<T> From<Gray<T>> for RGB<T> where
    T: Clone
[src]

pub fn from(other: Gray<T>) -> RGB<T>[src]

Performs the conversion.

impl From<RGB<f32>> for RGB<f64>[src]

pub fn from(other: RGB<f32>) -> RGB<f64>[src]

Performs the conversion.

impl From<RGB<i16>> for RGB<f64>[src]

pub fn from(other: RGB<i16>) -> RGB<f64>[src]

Performs the conversion.

impl From<RGB<i16>> for RGB<f32>[src]

pub fn from(other: RGB<i16>) -> RGB<f32>[src]

Performs the conversion.

impl From<RGB<i32>> for RGB<f64>[src]

pub fn from(other: RGB<i32>) -> RGB<f64>[src]

Performs the conversion.

impl From<RGB<u16>> for RGB<i32>[src]

pub fn from(other: RGB<u16>) -> RGB<i32>[src]

Performs the conversion.

impl From<RGB<u16>> for RGB<f32>[src]

pub fn from(other: RGB<u16>) -> RGB<f32>[src]

Performs the conversion.

impl From<RGB<u16>> for RGB<f64>[src]

pub fn from(other: RGB<u16>) -> RGB<f64>[src]

Performs the conversion.

impl From<RGB<u8>> for RGB<i16>[src]

pub fn from(other: RGB<u8>) -> RGB<i16>[src]

Performs the conversion.

impl From<RGB<u8>> for RGB<f64>[src]

pub fn from(other: RGB<u8>) -> RGB<f64>[src]

Performs the conversion.

impl From<RGB<u8>> for RGB<f32>[src]

pub fn from(other: RGB<u8>) -> RGB<f32>[src]

Performs the conversion.

impl<T> FromIterator<T> for RGB<T>[src]

pub fn from_iter<I>(into_iter: I) -> RGB<T> where
    I: IntoIterator<Item = T>, 
[src]

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]

pub fn hash<__H>(&self, state: &mut __H) where
    __H: Hasher
[src]

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]

Feeds a slice of this type into the given Hasher. Read more

impl<T> Into<[T; 3]> for RGB<T>[src]

pub fn into(self) -> [T; 3][src]

Performs the conversion.

impl<T> Into<(T, T, T)> for RGB<T>[src]

pub fn into(self) -> (T, T, T)[src]

Performs the conversion.

impl<T> LowerHex for RGB<T> where
    T: LowerHex
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter.

impl<T> Mul<T> for RGB<T> where
    T: Copy + Mul<T, Output = T>, 
[src]

px * 1

type Output = RGB<T>

The resulting type after applying the * operator.

pub fn mul(self, r: T) -> <RGB<T> as Mul<T>>::Output[src]

Performs the * operation. Read more

impl<T> MulAssign<T> for RGB<T> where
    T: Copy + Mul<T, Output = T>, 
[src]

px * 1

pub fn mul_assign(&mut self, r: T)[src]

Performs the *= operation. Read more

impl<ComponentType> Ord for RGB<ComponentType> where
    ComponentType: Ord
[src]

pub fn cmp(&self, other: &RGB<ComponentType>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<ComponentType> PartialEq<RGB<ComponentType>> for RGB<ComponentType> where
    ComponentType: PartialEq<ComponentType>, 
[src]

pub fn eq(&self, other: &RGB<ComponentType>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &RGB<ComponentType>) -> bool[src]

This method tests for !=.

impl<ComponentType> PartialOrd<RGB<ComponentType>> for RGB<ComponentType> where
    ComponentType: PartialOrd<ComponentType>, 
[src]

pub fn partial_cmp(&self, other: &RGB<ComponentType>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T> Sub<RGB<T>> for RGB<T> where
    T: Sub<T>, 
[src]

px - px

type Output = RGB<<T as Sub<T>>::Output>

The resulting type after applying the - operator.

pub fn sub(self, other: RGB<T>) -> <RGB<T> as Sub<RGB<T>>>::Output[src]

Performs the - operation. Read more

impl<T> Sub<T> for RGB<T> where
    T: Copy + Sub<T, Output = T>, 
[src]

px - 1

type Output = RGB<<T as Sub<T>>::Output>

The resulting type after applying the - operator.

pub fn sub(self, r: T) -> <RGB<T> as Sub<T>>::Output[src]

Performs the - operation. Read more

impl<T> SubAssign<RGB<T>> for RGB<T> where
    T: Sub<T, Output = T> + Copy
[src]

px - px

pub fn sub_assign(&mut self, other: RGB<T>)[src]

Performs the -= operation. Read more

impl<T> SubAssign<T> for RGB<T> where
    T: Copy + Sub<T, Output = T>, 
[src]

px - 1

pub fn sub_assign(&mut self, r: T)[src]

Performs the -= operation. Read more

impl<T> Sum<RGB<T>> for RGB<T> where
    T: Default + Add<T, Output = T>, 
[src]

pub fn sum<I>(iter: I) -> RGB<T> where
    I: Iterator<Item = RGB<T>>, 
[src]

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

impl<T> UpperHex for RGB<T> where
    T: UpperHex
[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter.

impl<T> Zeroable for RGB<T> where
    T: Zeroable, 
[src]

fn zeroed() -> Self

impl<ComponentType> Copy for RGB<ComponentType> where
    ComponentType: Copy
[src]

impl<ComponentType> Eq for RGB<ComponentType> where
    ComponentType: Eq
[src]

impl<T> Pod for RGB<T> where
    T: Pod, 
[src]

impl<ComponentType> StructuralEq for RGB<ComponentType>[src]

impl<ComponentType> StructuralPartialEq for RGB<ComponentType>[src]

Auto Trait Implementations

impl<ComponentType> RefUnwindSafe for RGB<ComponentType> where
    ComponentType: RefUnwindSafe

impl<ComponentType> Send for RGB<ComponentType> where
    ComponentType: Send

impl<ComponentType> Sync for RGB<ComponentType> where
    ComponentType: Sync

impl<ComponentType> Unpin for RGB<ComponentType> where
    ComponentType: Unpin

impl<ComponentType> UnwindSafe for RGB<ComponentType> where
    ComponentType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.