Struct rgb::RGBA [] [src]

#[repr(C)]
pub struct RGBA<ComponentType, AlphaComponentType = ComponentType> { pub r: ComponentType, pub g: ComponentType, pub b: ComponentType, pub a: AlphaComponentType, }

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

You can specify a different type for alpha, but it's only for special cases (e.g. if you use a newtype like RGBA, u16>).

Fields

Red

Green

Blue

Alpha

Methods

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

[src]

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

[src]

Iterate over all components (length=4)

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

[src]

Copy RGB components out of the RGBA struct

impl<T, A> RGBA<T, A>
[src]

[src]

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

impl<T: Copy, A: Clone> RGBA<T, A>
[src]

[src]

Create new RGBA with the same alpha value, but different RGB values

Trait Implementations

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

[src]

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

impl<T: Copy, B> ComponentMap<RGBA<B>, T, B> for RGBA<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 RGBA<T>
[src]

[src]

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

[src]

impl<T: Copy> From<RGB<T>> for RGBA<T, u8>
[src]

Assumes 255 is opaque

[src]

Performs the conversion.

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

[src]

Formats the value using the given formatter. Read more

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<T: Clone + Copy + Add> Add<T> for RGBA<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 RGBA<T> where
    T: Mul<Output = T>, 
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Formats the value using the given formatter.

impl<ComponentType: Default, AlphaComponentType: Default> Default for RGBA<ComponentType, AlphaComponentType>
[src]

[src]

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

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

impl<ComponentType: PartialEq, AlphaComponentType: PartialEq> PartialEq for RGBA<ComponentType, AlphaComponentType>
[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, AlphaComponentType: Ord> Ord for RGBA<ComponentType, AlphaComponentType>
[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, AlphaComponentType: PartialOrd> PartialOrd for RGBA<ComponentType, AlphaComponentType>
[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, AlphaComponentType: Hash> Hash for RGBA<ComponentType, AlphaComponentType>
[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