pub struct Color {
pub red: f64,
pub green: f64,
pub blue: f64,
pub alpha: f64,
}Expand description
A premultiplied, sRGB-encoded RGBA storage value with components in the
0..=1 range and no color component above alpha: the values an
intermediate texture holds, not linear light.
crate::Renderer::render_solid clears to it as given, and a
composite’s background (crate::RenderGraph::add_composite_over) is
the bottom layer as stored, which a linear-light blend decodes like any
other layer. A color meant in linear light is encoded first: mid-grey
#808080 is 0.502, not its linear 0.216, which would store as
#373737.
Fields§
§red: f64Red component.
green: f64Green component.
blue: f64Blue component.
alpha: f64Alpha component.
Implementations§
Source§impl Color
impl Color
Sourcepub fn source_over(self, source: Self) -> Self
pub fn source_over(self, source: Self) -> Self
Composites a premultiplied source color over this premultiplied color.
Both RGB triplets must already be multiplied by their alpha components.
This is the exact Porter-Duff source-over equation used by the GPU blend
state: out = source + destination * (1 - source_alpha).
Trait Implementations§
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
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
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> 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> ⓘ
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> ⓘ
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