Struct rgb::RGBA [] [src]

pub struct RGBA<ComponentType> {
    pub r: ComponentType,
    pub g: ComponentType,
    pub b: ComponentType,
    pub a: ComponentType,
}

Fields

r: ComponentType g: ComponentType b: ComponentType a: ComponentType

Methods

impl<T: Clone> RGBA<T>
[src]

fn new(r: T, g: T, b: T, a: T) -> RGBA<T>

fn iter(&self) -> Cloned<Iter<T>>

fn rgb(&self) -> RGB<T>

Copy RGB components of of the RGBA struct

fn rgb_mut(&mut self) -> &mut RGB<T>

Provide a mutable view of only RGB components (leaving out alpha). Useful to change color without changing opacity.

Trait Implementations

impl<ComponentType: PartialOrd> PartialOrd for RGBA<ComponentType>
[src]

fn partial_cmp(&self, __arg_0: &RGBA<ComponentType>) -> Option<Ordering>

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

fn lt(&self, __arg_0: &RGBA<ComponentType>) -> bool

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

fn le(&self, __arg_0: &RGBA<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, __arg_0: &RGBA<ComponentType>) -> bool

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

fn ge(&self, __arg_0: &RGBA<ComponentType>) -> bool

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

impl<ComponentType: Ord> Ord for RGBA<ComponentType>
[src]

fn cmp(&self, __arg_0: &RGBA<ComponentType>) -> Ordering

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

impl<ComponentType: PartialEq> PartialEq for RGBA<ComponentType>
[src]

fn eq(&self, __arg_0: &RGBA<ComponentType>) -> bool

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

fn ne(&self, __arg_0: &RGBA<ComponentType>) -> bool

This method tests for !=.

impl<ComponentType: Eq> Eq for RGBA<ComponentType>
[src]

impl<ComponentType: Debug> Debug for RGBA<ComponentType>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<ComponentType: Clone> Clone for RGBA<ComponentType>
[src]

fn clone(&self) -> RGBA<ComponentType>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<ComponentType: Copy> Copy for RGBA<ComponentType>
[src]

impl<T: Copy, B> ComponentMap<RGBA<B>, T, B> for RGBA<T>
[src]

fn map<F>(&self, f: F) -> RGBA<B> where F: FnMut(T) -> B

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

impl<T> ComponentBytes<T> for RGBA<T>
[src]

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

The components interpreted as an array, e.g. RGB gives 3-element slice. The red component is first.

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

fn as_bytes(&self) -> &[u8]

The components interpreted as raw bytes, in machine's native endian. Bytes of the red component are first.

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

fn from_iter<I: IntoIterator<Item=T>>(into_iter: I) -> RGBA<T>

Creates a value from an iterator. Read more

impl<T: Display> Display for RGBA<T>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Clone + Add> Add<RGBA<T>> for RGBA<T> where RGBA<T>: FromIterator<T::Output>, T: From<T::Output>
[src]

type Output = RGBA<T>

The resulting type after applying the + operator

fn add(self, other: RGBA<T>) -> Self::Output

The method for the + operator

impl<T: Clone + Sub> Sub<RGBA<T>> for RGBA<T> where RGBA<T>: FromIterator<T::Output>, T: From<T::Output>
[src]

type Output = RGBA<T>

The resulting type after applying the - operator

fn sub(self, other: RGBA<T>) -> Self::Output

The method for the - operator

impl<T: Clone + Copy + Add> Add<T> for RGBA<T> where T: Add<Output=T>
[src]

type Output = RGBA<T>

The resulting type after applying the + operator

fn add(self, r: T) -> Self::Output

The method for the + operator

impl<T: Clone + Copy + Mul> Mul<T> for RGBA<T> where T: Mul<Output=T>
[src]

type Output = RGBA<T>

The resulting type after applying the * operator

fn mul(self, r: T) -> Self::Output

The method for the * operator

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

fn from(other: RGBA<u16>) -> Self

Performs the conversion.

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

fn from(other: RGBA<u8>) -> Self

Performs the conversion.

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

fn from(other: RGBA<u8>) -> Self

Performs the conversion.

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

fn from(other: RGBA<u16>) -> Self

Performs the conversion.

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

fn from(other: RGBA<u16>) -> Self

Performs the conversion.

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

fn from(other: RGBA<i16>) -> Self

Performs the conversion.

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

fn from(other: RGBA<i16>) -> Self

Performs the conversion.

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

fn from(other: RGBA<i32>) -> Self

Performs the conversion.

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

fn from(other: RGBA<f32>) -> Self

Performs the conversion.