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]

[src]

Convenience function for creating a new pixel

[src]

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

[src]

[src]

Trait Implementations

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

[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]

[src]

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

[src]

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

[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]

[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.

[src]

Performs the + operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the * operator.

[src]

Performs the * operation.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Formats the value using the given formatter.

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

[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]

[src]

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

[src]

This method tests for !=.

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

[src]

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

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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]

[src]

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

1.3.0
[src]

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