pub struct Color {
pub r: f64,
pub g: f64,
pub b: f64,
pub a: f64,
}Expand description
An RGBA color with channels stored as floats in the 0.0..=1.0 range.
Fields§
§r: f64§g: f64§b: f64§a: f64Implementations§
Source§impl Color
impl Color
pub fn new(r: f64, g: f64, b: f64, a: f64) -> Color
Sourcepub fn from_rgba8(r: f64, g: f64, b: f64, a: f64) -> Color
pub fn from_rgba8(r: f64, g: f64, b: f64, a: f64) -> Color
From 8-bit RGB channels plus a 0.0..=1.0 alpha.
Sourcepub fn to_rgba_unit(self) -> [f64; 4]
pub fn to_rgba_unit(self) -> [f64; 4]
The premultiplied-alpha [r, g, b, a] representation used when a color
value is serialized as a spec-fixture output. MapLibre stores colors
premultiplied internally, so ["interpolate", ...] results and other
color outputs compare against [r*a, g*a, b*a, a].
Sourcepub fn to_rgba255(self) -> [f64; 4]
pub fn to_rgba255(self) -> [f64; 4]
The to-rgba operator representation: straight (non-premultiplied)
[r, g, b, a] with r/g/b in 0..=255 and alpha in 0.0..=1.0.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
Converts
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>
Converts
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