pub struct RGB(pub f32, pub f32, pub f32);Expand description
RGB color with three 0..1 float channels.
This is a tuple struct with public fields:
| Field | Range | Description |
|---|---|---|
.0 | 0..1 | Red channel |
.1 | 0..1 | Green channel |
.2 | 0..1 | Blue channel |
§Arithmetic
RGB implements [Add], [Sub], [Mul] (componentwise), [Mul<f32>],
and [Div<f32>] via the [ChannelArray<3>] impl. These operate on all
three channels independently.
§Conversions
use optic_color::*;
let rgb = RGB(0.5, 0.2, 0.8);
let rgba: RGBA = rgb.into(); // alpha = 1.0
let rgba = rgb.to_rgba(0.5); // custom alpha
let arr: [f32; 3] = rgb.into(); // flattenSee also RGBA, [HSV], [HSL].
Tuple Fields§
§0: f32§1: f32§2: f32Implementations§
Trait Implementations§
Source§impl ChannelArray<3> for RGB
impl ChannelArray<3> for RGB
impl Copy 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 UnsafeUnpin for RGB
impl UnwindSafe for RGB
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ColorInfo for Twhere
T: ToRgba,
impl<T> ColorInfo for Twhere
T: ToRgba,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more