Struct rgb::RGB [] [src]

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

This is it. The component type can be u8 (aliased as RGB8), u16 (aliased as RGB16), or any other type (but simple copyable types are recommended.)

Fields

Red

Green

Blue

Methods

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

Convenience function for creating a new pixel

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

Trait Implementations

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

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

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

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

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

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

Takes exactly 3 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.

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

Formats the value using the given formatter. Read more

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

The resulting type after applying the + operator

The method for the + operator

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

The resulting type after applying the - operator

The method for the - operator

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

The resulting type after applying the + operator

The method for the + operator

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

The resulting type after applying the * operator

The method for the * operator

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Formats the value using the given formatter.

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

Returns the "default value" for a type. Read more

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

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

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

This method tests for !=.

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

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

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

Compares and returns the maximum of two values. Read more

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

Compares and returns the minimum of two values. Read more

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

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

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

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

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

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

impl<ComponentType: Hash> Hash for RGB<ComponentType>
[src]

Feeds this value into the given [Hasher]. Read more

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