Struct picto::color::Srgb [−][src]
Expand description
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.
Implementations
Create a new sRGB encoded color with transparency.
Create a new opaque sRGB encoded color from u8
values.
Create a new sRGB encoded color, with transparency, from u8
values.
Create a new sRGB encoded color from a pixel value.
Transform this color into a pixel representation.
Convert linear color components to sRGB encoding.
Trait Implementations
type Epsilon = <T as ApproxEq>::Epsilon
type Epsilon = <T as ApproxEq>::Epsilon
Used for specifying relative comparisons.
The default tolerance to use when testing values that are close together. Read more
The default relative tolerance for testing values that are far-apart. Read more
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses a relative comparison if the values are far apart.
A test for equality that uses units in the last place (ULP) if the values are far apart.
The inverse of ApproxEq::relative_eq
.
Auto Trait Implementations
impl<T> RefUnwindSafe for Srgb<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Srgb<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more