Struct RGB

Source
pub struct RGB { /* private fields */ }

Implementations§

Source§

impl RGB

Source

pub fn new(r: f64, g: f64, b: f64) -> Self

Source

pub fn black() -> Self

Source

pub fn white() -> Self

Source

pub fn red() -> Self

Source

pub fn green() -> Self

Source

pub fn blue() -> Self

Source

pub fn r(self) -> f64

Source

pub fn g(self) -> f64

Source

pub fn b(self) -> f64

Source§

impl RGB

Source

pub fn sum(self) -> f64

Source

pub fn gray(self) -> f64

Source

pub fn luma1(self) -> f64

Source

pub fn luma2(self) -> f64

Source

pub fn min_element(self) -> f64

Source

pub fn max_element(self) -> f64

Source

pub fn is_finite(self) -> bool

Source

pub fn is_nan(self) -> bool

Source

pub fn is_infinite(self) -> bool

Source

pub fn clamp(self, min: Self, max: Self) -> Self

Source

pub fn min(self, rhs: Self) -> Self

Source

pub fn max(self, rhs: Self) -> Self

Source

pub fn abs(self) -> Self

Source

pub fn round(self) -> Self

Source

pub fn floor(self) -> Self

Source

pub fn ceil(self) -> Self

Source

pub fn trunc(self) -> Self

Source

pub fn fract(self) -> Self

Source

pub fn sqrt(self) -> Self

Source

pub fn exp(self) -> Self

Source

pub fn exp2(self) -> Self

Source

pub fn ln(self) -> Self

Source

pub fn log(self, base: f64) -> Self

Source

pub fn log2(self) -> Self

Source

pub fn log10(self) -> Self

Source

pub fn cbrt(self) -> Self

Source

pub fn powf(self, n: f64) -> Self

Source

pub fn sin(self) -> Self

Source

pub fn cos(self) -> Self

Source

pub fn tan(self) -> Self

Source

pub fn sin_cos(self) -> (Self, Self)

Source

pub fn recip(self) -> Self

Source

pub fn saturate(self) -> Self

Source

pub fn lerp(self, rhs: Self, s: f64) -> Self

Source

pub fn gamma_correct(self) -> Self

Source§

impl RGB

Source

pub fn to_array(self) -> [f64; 3]

Source

pub fn to_tuple(self) -> (f64, f64, f64)

Source

pub fn to_rgbf(self) -> RGBf

Source

pub fn to_rgba(self) -> RGBA

Source

pub fn to_rgba_alpha(self, alpha: f64) -> RGBA

Source

pub fn to_rgbaf(self) -> RGBAf

Source

pub fn to_rgbaf_alpha(self, alpha: f32) -> RGBAf

Source

pub fn to_rgb24(self) -> RGB24

Source

pub fn to_rgba32(self) -> RGBA32

Source

pub fn to_rgba32_alpha(self, alpha: u8) -> RGBA32

Trait Implementations§

Source§

impl Add<RGB> for f64

Source§

type Output = RGB

The resulting type after applying the + operator.
Source§

fn add(self, rhs: RGB) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<f64> for RGB

Source§

type Output = RGB

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for RGB

Source§

type Output = RGB

The resulting type after applying the + operator.
Source§

fn add(self, rhs: RGB) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<f64> for RGB

Source§

fn add_assign(&mut self, rhs: f64)

Performs the += operation. Read more
Source§

impl AddAssign for RGB

Source§

fn add_assign(&mut self, rhs: RGB)

Performs the += operation. Read more
Source§

impl Clone for RGB

Source§

fn clone(&self) -> RGB

Returns a duplicate 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 Debug for RGB

Source§

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

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

impl Default for RGB

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for RGB

Source§

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

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

impl Div<RGB> for f64

Source§

type Output = RGB

The resulting type after applying the / operator.
Source§

fn div(self, rhs: RGB) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f64> for RGB

Source§

type Output = RGB

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for RGB

Source§

type Output = RGB

The resulting type after applying the / operator.
Source§

fn div(self, rhs: RGB) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<f64> for RGB

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl DivAssign for RGB

Source§

fn div_assign(&mut self, rhs: RGB)

Performs the /= operation. Read more
Source§

impl From<[f64; 3]> for RGB

Source§

fn from(rgb: [f64; 3]) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 3]> for RGB

Source§

fn from(rgb: [u8; 3]) -> Self

Converts to this type from the input type.
Source§

impl From<(f64, f64, f64)> for RGB

Source§

fn from(rgb: (f64, f64, f64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u8, u8)> for RGB

Source§

fn from(rgb: (u8, u8, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<RGB> for RGB24

Source§

fn from(color: RGB) -> Self

Converts to this type from the input type.
Source§

impl From<RGB> for RGBA

Source§

fn from(color: RGB) -> Self

Converts to this type from the input type.
Source§

impl From<RGB> for RGBA32

Source§

fn from(color: RGB) -> Self

Converts to this type from the input type.
Source§

impl From<RGB> for RGBAf

Source§

fn from(color: RGB) -> Self

Converts to this type from the input type.
Source§

impl From<RGB> for RGBf

Source§

fn from(color: RGB) -> Self

Converts to this type from the input type.
Source§

impl From<RGB24> for RGB

Source§

fn from(color: RGB24) -> Self

Converts to this type from the input type.
Source§

impl From<RGBA> for RGB

Source§

fn from(color: RGBA) -> Self

Converts to this type from the input type.
Source§

impl From<RGBA32> for RGB

Source§

fn from(color: RGBA32) -> Self

Converts to this type from the input type.
Source§

impl From<RGBAf> for RGB

Source§

fn from(color: RGBAf) -> Self

Converts to this type from the input type.
Source§

impl From<RGBf> for RGB

Source§

fn from(color: RGBf) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for RGB

Source§

fn from(rgb: f64) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for RGB

Source§

fn from(rgb_: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for RGB

Source§

fn from(rgb: u8) -> Self

Converts to this type from the input type.
Source§

impl Index<usize> for RGB

Source§

type Output = f64

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

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

impl IndexMut<usize> for RGB

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

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

impl Mul<RGB> for f64

Source§

type Output = RGB

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: RGB) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f64> for RGB

Source§

type Output = RGB

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for RGB

Source§

type Output = RGB

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: RGB) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f64> for RGB

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl MulAssign for RGB

Source§

fn mul_assign(&mut self, rhs: RGB)

Performs the *= operation. Read more
Source§

impl Neg for RGB

Source§

type Output = RGB

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for RGB

Source§

fn eq(&self, other: &RGB) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub<RGB> for f64

Source§

type Output = RGB

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: RGB) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<f64> for RGB

Source§

type Output = RGB

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for RGB

Source§

type Output = RGB

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: RGB) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<f64> for RGB

Source§

fn sub_assign(&mut self, rhs: f64)

Performs the -= operation. Read more
Source§

impl SubAssign for RGB

Source§

fn sub_assign(&mut self, rhs: RGB)

Performs the -= operation. Read more
Source§

impl Copy for RGB

Source§

impl StructuralPartialEq for RGB

Auto Trait Implementations§

§

impl Freeze for RGB

§

impl RefUnwindSafe for RGB

§

impl Send for RGB

§

impl Sync for RGB

§

impl Unpin for RGB

§

impl UnwindSafe for RGB

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.