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