Struct Rgb

struct Rgb<T> { ... }

A Red + Green + Blue pixel.

Examples

use rgb::Rgb;

let pixel: Rgb<u8> = Rgb { r: 0, g: 0, b: 0 };

Fields

r: T

Red Component

g: T

Green Component

b: T

Blue Component

Implementations

impl<T: Clone> Rgb<T>

fn with_alpha(self: &Self, a: T) -> RGBA<T>

Convenience function for converting to RGBA

fn new_alpha<A>(self: &Self, a: A) -> RGBA<T, A>

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

impl<T: Clone> Rgb<T>

fn iter(self: &Self) -> Cloned<Iter<'_, T>>

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

impl<T: Copy> Rgb<T>

const fn new(red: T, green: T, blue: T) -> Self

Creates a new Rgb pixel type from its components.

Alternatively, you can use struct literal syntax to create the new pixel type:

use rgb::Rgb;

let pixel = Rgb {r : red, g : green, b : blue};

impl From for Rgb<f32>

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

impl From for Rgb<f32>

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

impl From for Rgb<f32>

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

impl From for Rgb<f64>

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

impl From for Rgb<f64>

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

impl From for Rgb<f64>

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

impl From for Rgb<f64>

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

impl From for Rgb<f64>

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

impl From for Rgb<i16>

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

impl From for Rgb<i32>

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

impl From for Rgb<i32>

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

impl From for Rgb<u16>

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

impl From for Rgb<u32>

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

impl From for Rgb<u32>

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

impl From for Rgb<u64>

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

impl<R, S> From for Rgb<S>

fn from(value: (R, R, R)) -> Self

impl<T> Add for Rgb<T>

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

impl<T> AddAssign for Rgb<T>

fn add_assign(self: &mut Self, r: T)

impl<T> AddAssign for Rgb<T>

fn add_assign(self: &mut Self, other: RGB<T>)

impl<T> Any for Rgb<T>

fn type_id(self: &Self) -> TypeId

impl<T> AsMut for Rgb<T>

fn as_mut(self: &mut Self) -> &mut [T]

impl<T> AsRef for Rgb<T>

fn as_ref(self: &Self) -> &[T]

impl<T> Borrow for Rgb<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Rgb<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Rgb<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ComponentSlice for Rgb<T>

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

impl<T> Div for Rgb<T>

fn div(self: Self, r: T) -> <Self as >::Output

impl<T> DivAssign for Rgb<T>

fn div_assign(self: &mut Self, r: T)

impl<T> Freeze for Rgb<T>

impl<T> From for Rgb<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> From for Rgb<T>

fn from(other: GRB<T>) -> Self

impl<T> From for Rgb<T>

fn from(other: BGR<T>) -> Self

impl<T> FromIterator for Rgb<T>

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

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

impl<T> Mul for Rgb<T>

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

impl<T> MulAssign for Rgb<T>

fn mul_assign(self: &mut Self, r: T)

impl<T> MulAssign for Rgb<T>

fn mul_assign(self: &mut Self, other: RGB<T>)

impl<T> RefUnwindSafe for Rgb<T>

impl<T> Send for Rgb<T>

impl<T> StructuralPartialEq for Rgb<T>

impl<T> Sub for Rgb<T>

fn sub(self: Self, r: T) -> <Self as >::Output

impl<T> SubAssign for Rgb<T>

fn sub_assign(self: &mut Self, other: RGB<T>)

impl<T> SubAssign for Rgb<T>

fn sub_assign(self: &mut Self, r: T)

impl<T> Sum for Rgb<T>

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

impl<T> Sync for Rgb<T>

impl<T> Unpin for Rgb<T>

impl<T> UnsafeUnpin for Rgb<T>

impl<T> UnwindSafe for Rgb<T>

impl<T, U> Into for Rgb<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Rgb<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Rgb<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone> Clone for Rgb<T>

fn clone(self: &Self) -> Rgb<T>

impl<T: $crate::cmp::Eq> Eq for Rgb<T>

impl<T: $crate::cmp::Ord> Ord for Rgb<T>

fn cmp(self: &Self, other: &Rgb<T>) -> Ordering

impl<T: $crate::cmp::PartialEq> PartialEq for Rgb<T>

fn eq(self: &Self, other: &Rgb<T>) -> bool

impl<T: $crate::cmp::PartialOrd> PartialOrd for Rgb<T>

fn partial_cmp(self: &Self, other: &Rgb<T>) -> Option<Ordering>

impl<T: $crate::default::Default> Default for Rgb<T>

fn default() -> Rgb<T>

impl<T: $crate::fmt::Debug> Debug for Rgb<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: $crate::hash::Hash> Hash for Rgb<T>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl<T: $crate::marker::Copy> Copy for Rgb<T>

impl<T: Add> Add for Rgb<T>

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

impl<T: Clone> From for Rgb<T>

fn from(other: Gray<T>) -> Self

impl<T: Copy> From for Rgb<T>

fn from(other: [T; 3]) -> Self

impl<T: Copy, B> ColorComponentMap for Rgb<T>

fn map_colors<F>(self: &Self, f: F) -> RGB<B>
where
    F: FnMut(T) -> B

impl<T: Copy, B> ComponentMap for Rgb<T>

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

impl<T: Mul> Mul for Rgb<T>

fn mul(self: Self, other: RGB<T>) -> <Self as >::Output

impl<T: Sub> Sub for Rgb<T>

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

impl<T: fmt::Display> Display for Rgb<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: fmt::LowerHex> LowerHex for Rgb<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: fmt::UpperHex> UpperHex for Rgb<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result