Struct color::Rgb

source ·
pub struct Rgb<T = u8, S = Srgb> {
    pub r: T,
    pub g: T,
    pub b: T,
    /* private fields */
}

Fields§

§r: T§g: T§b: T

Implementations§

source§

impl<T, S> Rgb<T, S>

source

pub const fn new(r: T, g: T, b: T) -> Rgb<T, S>

source§

impl<T: Channel, S: TransferFunction> Rgb<T, S>

source

pub fn from_hex(hex: u32) -> Rgb<T, S>

source

pub fn rg(&self) -> Rg<T, S>

source

pub fn rb(&self) -> Rg<T, S>

source

pub fn gr(&self) -> Rg<T, S>

source

pub fn gb(&self) -> Rg<T, S>

source

pub fn br(&self) -> Rg<T, S>

source

pub fn bg(&self) -> Rg<T, S>

source

pub fn rgb(&self) -> Rgb<T, S>

source

pub fn rbg(&self) -> Rgb<T, S>

source

pub fn bgr(&self) -> Rgb<T, S>

source

pub fn brg(&self) -> Rgb<T, S>

source

pub fn grb(&self) -> Rgb<T, S>

source

pub fn gbr(&self) -> Rgb<T, S>

source§

impl<T: Channel, S: TransferFunction> Rgb<T, S>

source

pub fn to_standard<S2: TransferFunction>(&self) -> Rgb<T, S2>

source

pub fn to_linear(&self) -> Rgb<T, LinearRgb>

source§

impl Rgb<f32>

Trait Implementations§

source§

impl<T: Channel + Add<T, Output = T>, S> Add<Rgb<T, S>> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Rgb<T, S>) -> Rgb<T, S>

Performs the + operation. Read more
source§

impl<T, S> AsMut<[T; 3]> for Rgb<T, S>

source§

fn as_mut(&mut self) -> &mut [T; 3]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T, S> AsRef<[T; 3]> for Rgb<T, S>

source§

fn as_ref(&self) -> &[T; 3]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T, S> Borrow<[T; 3]> for Rgb<T, S>

source§

fn borrow(&self) -> &[T; 3]

Immutably borrows from an owned value. Read more
source§

impl<T, S> BorrowMut<[T; 3]> for Rgb<T, S>

source§

fn borrow_mut(&mut self) -> &mut [T; 3]

Mutably borrows from an owned value. Read more
source§

impl<T: Clone, S> Clone for Rgb<T, S>

source§

fn clone(&self) -> Rgb<T, S>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Channel, S> Color<T> for Rgb<T, S>

source§

fn clamp_s(self, lo: T, hi: T) -> Rgb<T, S>

Clamps the components of the color to the range (lo,hi).

source§

fn clamp_c(self, lo: Rgb<T, S>, hi: Rgb<T, S>) -> Rgb<T, S>

Clamps the components of the color component-wise between lo and hi.

source§

fn inverse(self) -> Rgb<T, S>

Inverts the color.

source§

fn mix(self, other: Self, value: T) -> Self

source§

impl<T: Debug, S: Default + Debug> Debug for Rgb<T, S>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de, T, S> Deserialize<'de> for Rgb<T, S>where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Channel, S> Div<Rgb<T, S>> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Rgb<T, S>) -> Rgb<T, S>

Performs the / operation. Read more
source§

impl<T: Channel + Div<T, Output = T>, S> Div<T> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Rgb<T, S>

Performs the / operation. Read more
source§

impl<T: FloatChannel, S> FloatColor<T> for Rgb<T, S>

source§

fn saturate(self) -> Rgb<T, S>

Clamps the components of the color to the range (0,1).

source§

impl<T: Channel, S> From<Rgb<T, S>> for Vec3<T>

source§

fn from(rgb: Rgb<T, S>) -> Self

Converts to this type from the input type.
source§

impl<T, S> Index<usize> for Rgb<T, S>

§

type Output = T

The returned type after indexing.
source§

fn index<'a>(&'a self, index: usize) -> &'a T

Performs the indexing (container[index]) operation. Read more
source§

impl<T, S> IndexMut<usize> for Rgb<T, S>

source§

fn index_mut<'a>(&'a mut self, index: usize) -> &'a mut T

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<T: Channel, S> Mul<Rgb<T, S>> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Rgb<T, S>) -> Rgb<T, S>

Performs the * operation. Read more
source§

impl<T: Channel + Mul<T, Output = T>, S> Mul<T> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Rgb<T, S>

Performs the * operation. Read more
source§

impl<N: Clone + PartialEq + Num + NumCast, S> PartialEq<Rgb<N, S>> for Rgb<N, S>

source§

fn eq(&self, other: &Rgb<N, S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Channel + Saturating, S> Saturating for Rgb<T, S>

source§

fn saturating_add(self, v: Rgb<T, S>) -> Rgb<T, S>

Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing.
source§

fn saturating_sub(self, v: Rgb<T, S>) -> Rgb<T, S>

Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing.
source§

impl<T, S> Serialize for Rgb<T, S>where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Channel + Sub<T, Output = T>, S> Sub<Rgb<T, S>> for Rgb<T, S>

§

type Output = Rgb<T, S>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Rgb<T, S>) -> Rgb<T, S>

Performs the - operation. Read more
source§

impl<T: Channel, S: TransferFunction> ToHsl for Rgb<T, S>

§

type Standard = S

source§

fn to_hsl<U: Channel + NumCast + Num>(&self) -> Hsl<U, S>

source§

impl<T: Channel, S: TransferFunction> ToHsv for Rgb<T, S>

§

type Standard = S

source§

fn to_hsv<U: Channel + NumCast + Num>(&self) -> Hsv<U, S>

source§

impl<T: Channel, S: TransferFunction> ToLuma for Rgb<T, S>

§

type Standard = S

source§

fn to_luma<U: Channel>(&self) -> Luma<U, S>

source§

impl<T: Channel + Float + NumCast, S: MatrixColorSpace + TransferFunction> ToOkLab for Rgb<T, S>

source§

fn to_oklab<U: Channel>(&self) -> OkLab<U>

source§

impl<T: Channel, S: TransferFunction> ToRgb for Rgb<T, S>

§

type Standard = S

source§

fn to_rgb<U: Channel>(&self) -> Rgb<U, S>

source§

impl<T: Channel, S: TransferFunction> ToRgba for Rgb<T, S>

§

type Standard = S

source§

fn to_rgba<U: Channel>(&self) -> Rgba<U, S>

source§

impl<T: Channel, S: MatrixColorSpace + TransferFunction> ToXyz for Rgb<T, S>

§

type WhitePoint = D65

source§

fn to_xyz<U: Channel + Float>(&self) -> Xyz<U, D65>

source§

impl<T: Copy, S> Copy for Rgb<T, S>

source§

impl<N: Clone + PartialEq + Eq + Num + NumCast, S> Eq for Rgb<N, S>

Auto Trait Implementations§

§

impl<T, S> RefUnwindSafe for Rgb<T, S>where S: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, S> Send for Rgb<T, S>where S: Send, T: Send,

§

impl<T, S> Sync for Rgb<T, S>where S: Sync, T: Sync,

§

impl<T, S> Unpin for Rgb<T, S>where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for Rgb<T, S>where S: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,