[−][src]Struct nannou::color::pixel::Srgb
An sRGB encoded color.
sRGB is a common kind of gamma encoding, but it doesn't exactly follow the
power-law, as in GammaRgb
. It's perhaps the most
common color space for monitors and on the Internet, so it's usually safe
to assume that an image or pixel with unknown gamma is sRGB encoded.
use palette::Rgb; use palette::pixel::Srgb; let c: Rgb = Srgb::new(0.5, 0.3, 0.1).into(); assert_eq!((0.5f32, 0.3, 0.1), Srgb::from(c).to_pixel());
Fields
red: T
The red component, where 0.0 is no red light and 1.0 is the highest displayable amount.
green: T
The green component, where 0.0 is no red light and 1.0 is the highest displayable amount.
blue: T
The blue component, where 0.0 is no red light and 1.0 is the highest displayable amount.
alpha: T
The transparency of the color. 0.0 is completely transparent and 1.0 is completely opaque.
Methods
impl<T> Srgb<T> where
T: Float,
[src]
T: Float,
pub fn new(red: T, green: T, blue: T) -> Srgb<T>
[src]
Create a new opaque sRGB encoded color.
pub fn with_alpha(red: T, green: T, blue: T, alpha: T) -> Srgb<T>
[src]
Create a new sRGB encoded color with transparency.
pub fn new_u8(red: u8, green: u8, blue: u8) -> Srgb<T>
[src]
Create a new opaque sRGB encoded color from u8
values.
pub fn with_alpha_u8(red: u8, green: u8, blue: u8, alpha: u8) -> Srgb<T>
[src]
Create a new sRGB encoded color, with transparency, from u8
values.
pub fn from_pixel<P>(pixel: &P) -> Srgb<T> where
P: RgbPixel<T>,
[src]
P: RgbPixel<T>,
Create a new sRGB encoded color from a pixel value.
pub fn to_pixel<P>(&self) -> P where
P: RgbPixel<T>,
[src]
P: RgbPixel<T>,
Transform this color into a pixel representation.
pub fn from_linear<C>(color: C) -> Srgb<T> where
C: Into<Alpha<Rgb<T>, T>>,
[src]
C: Into<Alpha<Rgb<T>, T>>,
Convert linear color components to sRGB encoding.
pub fn to_linear(&self) -> Alpha<Rgb<T>, T>
[src]
Decode this color to a linear representation.
pub fn linear_to_pixel<C, P>(color: C) -> P where
C: Into<Alpha<Rgb<T>, T>>,
P: RgbPixel<T>,
[src]
C: Into<Alpha<Rgb<T>, T>>,
P: RgbPixel<T>,
Shortcut to convert a linear color to an sRGB encoded pixel.
Trait Implementations
impl<T> ApproxEq for Srgb<T> where
T: ApproxEq + Float,
<T as ApproxEq>::Epsilon: Copy,
<T as ApproxEq>::Epsilon: Float,
[src]
T: ApproxEq + Float,
<T as ApproxEq>::Epsilon: Copy,
<T as ApproxEq>::Epsilon: Float,
type Epsilon = <T as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <Srgb<T> as ApproxEq>::Epsilon
[src]
fn default_max_relative() -> <Srgb<T> as ApproxEq>::Epsilon
[src]
fn default_max_ulps() -> u32
[src]
fn relative_eq(
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_relative: <Srgb<T> as ApproxEq>::Epsilon
) -> bool
[src]
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_relative: <Srgb<T> as ApproxEq>::Epsilon
) -> bool
fn ulps_eq(
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
fn relative_ne(
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_relative: <Srgb<T> as ApproxEq>::Epsilon
) -> bool
[src]
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_relative: <Srgb<T> as ApproxEq>::Epsilon
) -> bool
fn ulps_ne(
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
&self,
other: &Srgb<T>,
epsilon: <Srgb<T> as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
impl<T> From<Srgb<T>> for Color<T> where
T: Float,
[src]
T: Float,
impl<T> From<Color<T>> for Srgb<T> where
T: Float,
[src]
T: Float,
impl<T> From<Srgb<T>> for Rgb<T> where
T: Float,
[src]
T: Float,
impl<T> From<Rgb<T>> for Srgb<T> where
T: Float,
[src]
T: Float,
impl<T> From<Srgb<T>> for Alpha<Rgb<T>, T> where
T: Float,
[src]
T: Float,
impl<T> From<Alpha<Rgb<T>, T>> for Srgb<T> where
T: Float,
[src]
T: Float,
impl<T> Debug for Srgb<T> where
T: Debug + Float,
[src]
T: Debug + Float,
impl<T> Copy for Srgb<T> where
T: Copy + Float,
[src]
T: Copy + Float,
impl<T> PartialEq<Srgb<T>> for Srgb<T> where
T: PartialEq<T> + Float,
[src]
T: PartialEq<T> + Float,
impl<T> Clone for Srgb<T> where
T: Clone + Float,
[src]
T: Clone + Float,
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> SafeBorrow<T> for T
[src]
impl<T> Erased for T
impl<S> FromSample<S> for S
[src]
fn from_sample_(s: S) -> S
[src]
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
[src]
U: FromSample<T>,
fn to_sample_(self) -> U
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
[src]
T: FromSample<S> + ToSample<S>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.