pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}
Expand description
Create a new Color
from four f32
’s in the range [0.0-1.0]
Create a new Color
from four u8
’s in the range [0-255]
Create a new Color
from three u8’s in the range [0-255]
,
with the alpha component fixed to 255 (opaque)
Return a tuple of four u8
’s in the range [0-255]
with the Color
’s
components.
Return a tuple of three u8
’s in the range [0-255]
with the Color
’s
components.
Convert a packed u32
containing 0xRRGGBBAA
into a Color
Convert a packed u32
containing 0x00RRGGBB
into a Color
.
This lets you do things like Color::from_rgb_u32(0xCD09AA)
easily if you want.
Convert a Color
into a packed u32
, containing 0xRRGGBBAA
as bytes.
Convert a Color
into a packed u32
, containing 0x00RRGGBB
as bytes.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Turns an [R, G, B, A] array of
f32's into a
Colorwith no format changes. All inputs should be in the range
[0.0-1.0]`.
Convert a (R, G, B, A)
tuple of f32
’s in the range [0.0-1.0]
into a Color
Convert a (R, G, B)
tuple of f32
’s in the range [0.0-1.0]
into a Color
,
with a value of 1.0 to for the alpha element (ie, no transparency.)
Convert a (R, G, B, A)
tuple of u8
’s in the range [0-255]
into a Color
Convert a (R, G, B)
tuple of u8
’s in the range [0-255]
into a Color
,
with a value of 255 for the alpha element (i.e., no transparency.)
Convert a Color
into a (R, G, B, A)
tuple of u8
’s in the range of [0-255]
.
Does the Wrong Thing if the Color
’s values are not in the range [0.0,1.0]
Convert a Color
into a (R, G, B)
tuple of u8
’s in the range of [0-255]
,
ignoring the alpha term.
Does the Wrong Thing if the Color
’s values are not in the range [0.0,1.0]
Convert a Color
into an [R, G, B, A]
array of f32
’s in the range of [0.0-1.0]
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Serialize this value into the given Serde serializer. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The alignment of pointer.
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
Initializes a with the given initializer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,