[−][src]Struct megaui::Color
A RGBA color in the sRGB
color space represented as f32
's in the range [0.0-1.0]
Fields
r: f32
Red component
g: f32
Green component
b: f32
Blue component
a: f32
Alpha component
Implementations
impl Color
[src]
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self
[src]
Create a new Color
from four f32
's in the range [0.0-1.0]
pub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Color
[src]
Create a new Color
from four u8
's in the range [0-255]
pub fn from_rgb(r: u8, g: u8, b: u8) -> Color
[src]
Create a new Color
from three u8's in the range [0-255]
,
with the alpha component fixed to 255 (opaque)
pub fn to_rgba(self) -> (u8, u8, u8, u8)
[src]
Return a tuple of four u8
's in the range [0-255]
with the Color
's
components.
pub fn to_rgb(self) -> (u8, u8, u8)
[src]
Return a tuple of three u8
's in the range [0-255]
with the Color
's
components.
pub fn from_rgba_u32(c: u32) -> Color
[src]
Convert a packed u32
containing 0xRRGGBBAA
into a Color
pub fn from_rgb_u32(c: u32) -> Color
[src]
Convert a packed u32
containing 0x00RRGGBB
into a Color
.
This lets you do things like Color::from_rgb_u32(0xCD09AA)
easily if you want.
pub fn to_rgba_u32(self) -> u32
[src]
Convert a Color
into a packed u32
, containing 0xRRGGBBAA
as bytes.
pub fn to_rgb_u32(self) -> u32
[src]
Convert a Color
into a packed u32
, containing 0x00RRGGBB
as bytes.
Trait Implementations
impl Clone for Color
[src]
impl Copy for Color
[src]
impl Debug for Color
[src]
impl From<[f32; 4]> for Color
[src]
fn from(val: [f32; 4]) -> Self
[src]
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]`.
impl From<(f32, f32, f32, f32)> for Color
[src]
fn from(val: (f32, f32, f32, f32)) -> Self
[src]
Convert a (R, G, B, A)
tuple of f32
's in the range [0.0-1.0]
into a Color
impl From<(f32, f32, f32)> for Color
[src]
fn from(val: (f32, f32, f32)) -> Self
[src]
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.)
impl From<(i32, i32, i32, f32)> for Color
[src]
impl From<(u8, u8, u8, u8)> for Color
[src]
fn from(val: (u8, u8, u8, u8)) -> Self
[src]
Convert a (R, G, B, A)
tuple of u8
's in the range [0-255]
into a Color
impl From<(u8, u8, u8)> for Color
[src]
fn from(val: (u8, u8, u8)) -> Self
[src]
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.)
impl From<Color> for (u8, u8, u8, u8)
[src]
fn from(color: Color) -> Self
[src]
Convert a Color
into a (R, G, B, A)
tuple of u8
's in the range of [0-255]
.
impl From<Color> for (u8, u8, u8)
[src]
fn from(color: Color) -> Self
[src]
Convert a Color
into a (R, G, B)
tuple of u8
's in the range of [0-255]
,
ignoring the alpha term.
impl From<Color> for [f32; 4]
[src]
fn from(color: Color) -> Self
[src]
Convert a Color
into an [R, G, B, A]
array of f32
's in the range of [0.0-1.0]
.
impl Into<String> for Color
[src]
impl PartialEq<Color> for Color
[src]
impl StructuralPartialEq for Color
[src]
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
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,
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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
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>,