[−][src]Struct sixtyfps::Color
Color represents a color in the SixtyFPS run-time, represented using 8-bit channels for red, green, blue and the alpha (opacity). It can be conveniently constructed and destructured using the to_ and from_ (a)rgb helper functions:
let col = some_color.to_argb_f32(); do_something_with_red_and_green(col.red, col.green); let RgbaColor { red, blue, green, .. } = some_color.to_argb_u8(); do_something_with_red(red); let new_col = Color::from(RgbaColor{ red: 0.5, green: 0.65, blue: 0.32, alpha: 1.});
Implementations
impl Color
[src]
pub const fn from_argb_encoded(encoded: u32) -> Color
[src]
Construct a color from an integer encoded as 0xAARRGGBB
pub fn as_argb_encoded(&self) -> u32
[src]
Returns (alpha, red, green, blue)
encoded as u32
pub fn from_argb_u8(alpha: u8, red: u8, green: u8, blue: u8) -> Color
[src]
Construct a color from the alpha, red, green and blue color channel parameters.
pub fn from_rgb_u8(red: u8, green: u8, blue: u8) -> Color
[src]
Construct a color from the red, green and blue color channel parameters. The alpha channel will have the value 255.
pub fn from_argb_f32(alpha: f32, red: f32, green: f32, blue: f32) -> Color
[src]
Construct a color from the alpha, red, green and blue color channel parameters.
pub fn from_rgb_f32(red: f32, green: f32, blue: f32) -> Color
[src]
Construct a color from the red, green and blue color channel parameters. The alpha channel will have the value 255.
pub fn to_argb_u8(&self) -> RgbaColor<u8>
[src]
Converts this color to an RgbaColor struct for easy destructuring.
pub fn to_argb_f32(&self) -> RgbaColor<f32>
[src]
Converts this color to an RgbaColor struct for easy destructuring.
pub fn red(self) -> u8
[src]
Returns the red channel of the color as u8 in the range 0..255.
pub fn green(self) -> u8
[src]
Returns the green channel of the color as u8 in the range 0..255.
pub fn blue(self) -> u8
[src]
Returns the blue channel of the color as u8 in the range 0..255.
pub fn alpha(self) -> u8
[src]
Returns the alpha channel of the color as u8 in the range 0..255.
Trait Implementations
impl Clone for Color
[src]
impl Copy for Color
[src]
impl Debug for Color
[src]
impl Default for Color
[src]
impl Display for Color
[src]
impl From<Color> for RgbaColor<f32>
[src]
impl From<Color> for RgbaColor<u8>
[src]
impl From<RgbaColor<f32>> for Color
[src]
impl From<RgbaColor<u8>> for Color
[src]
impl InterpolatedPropertyValue for Color
[src]
pub fn interpolate(self, target_value: Color, t: f32) -> Color
[src]
impl PartialEq<Color> for Color
[src]
impl StructuralPartialEq for Color
[src]
Auto Trait Implementations
impl RefUnwindSafe for Color
[src]
impl Send for Color
[src]
impl Sync for Color
[src]
impl Unpin for Color
[src]
impl UnwindSafe for Color
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,