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).