pub struct RGBA {
pub red: u8,
pub green: u8,
pub blue: u8,
pub alpha: u8,
}
Expand description
A color with red, green, blue, and alpha components, in a byte each.
Fields§
§red: u8
The red component.
green: u8
The green component.
blue: u8
The blue component.
alpha: u8
The alpha component.
Implementations§
Source§impl RGBA
impl RGBA
Sourcepub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Self
Constructs a new RGBA value from float components. It expects the red, green, blue and alpha channels in that order, and all values will be clamped to the 0.0 … 1.0 range.
Sourcepub fn transparent() -> Self
pub fn transparent() -> Self
Returns a transparent color.
Sourcepub fn new(red: u8, green: u8, blue: u8, alpha: f32) -> Self
pub fn new(red: u8, green: u8, blue: u8, alpha: f32) -> Self
Same thing, but with u8
values instead of floats in the 0 to 1 range.
Sourcepub fn red_f32(&self) -> f32
pub fn red_f32(&self) -> f32
Returns the red channel in a floating point number form, from 0 to 1.
Sourcepub fn green_f32(&self) -> f32
pub fn green_f32(&self) -> f32
Returns the green channel in a floating point number form, from 0 to 1.
Trait Implementations§
Source§impl From<FloatColor> for RGBA
impl From<FloatColor> for RGBA
Source§fn from(color: FloatColor) -> RGBA
fn from(color: FloatColor) -> RGBA
Converts to this type from the input type.
Source§impl From<PredefinedColor> for RGBA
impl From<PredefinedColor> for RGBA
Source§fn from(color: PredefinedColor) -> RGBA
fn from(color: PredefinedColor) -> RGBA
Converts to this type from the input type.
Source§impl From<RGBA> for SRGBLinear
impl From<RGBA> for SRGBLinear
Source§fn from(t: RGBA) -> SRGBLinear
fn from(t: RGBA) -> SRGBLinear
Converts to this type from the input type.
Source§impl From<SRGBLinear> for RGBA
impl From<SRGBLinear> for RGBA
Source§fn from(t: SRGBLinear) -> RGBA
fn from(t: SRGBLinear) -> RGBA
Converts to this type from the input type.
Source§impl<'i, V: ?Sized + Visitor<'i, T>, T: Visit<'i, T, V>> Visit<'i, T, V> for RGBA
Available on crate feature visitor
only.
impl<'i, V: ?Sized + Visitor<'i, T>, T: Visit<'i, T, V>> Visit<'i, T, V> for RGBA
Available on crate feature
visitor
only.Source§const CHILD_TYPES: VisitTypes
const CHILD_TYPES: VisitTypes
The types of values contained within this value and its children.
This is used to skip branches that don’t have any values requested
by the Visitor.
impl Copy for RGBA
impl StructuralPartialEq for RGBA
Auto Trait Implementations§
impl Freeze for RGBA
impl RefUnwindSafe for RGBA
impl Send for RGBA
impl Sync for RGBA
impl Unpin for RGBA
impl UnwindSafe for RGBA
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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