#[repr(transparent)]pub struct Color(_);
Expand description
[docs.microsoft.com] D3DCOLOR
0xAARRGGBB
Implementations
sourceimpl Color
impl Color
sourcepub fn argb(color: impl IntoARGB) -> Self
pub fn argb(color: impl IntoARGB) -> Self
Arguments
color
-0xAARRGGBB
,[0xAA, 0xRR, 0xGG, 0xBB]
, or(0xAA, 0xRR, 0xGG, 0xBB)
Examples
let colors = [
Color::argb(0xFF224466), // native endian
Color::argb([0xFF, 0x22, 0x44, 0x66]), // big endian!
Color::argb((0xFF, 0x22, 0x44, 0x66)), // big endian!
];
for color in colors.iter().copied() {
assert_eq!(0xFF, color.alpha());
assert_eq!(0x22, color.red());
assert_eq!(0x44, color.green());
assert_eq!(0x66, color.blue());
}
pub fn a(self) -> u8
pub fn r(self) -> u8
pub fn g(self) -> u8
pub fn b(self) -> u8
pub fn alpha(self) -> u8
pub fn red(self) -> u8
pub fn green(self) -> u8
pub fn blue(self) -> u8
Methods from Deref<Target = D3DCOLOR>
Trait Implementations
sourceimpl Ord for Color
impl Ord for Color
sourceimpl PartialOrd<Color> for Color
impl PartialOrd<Color> for Color
sourcefn partial_cmp(&self, other: &Color) -> Option<Ordering>
fn partial_cmp(&self, other: &Color) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Color
impl Eq for Color
impl Pod for Color
impl StructuralEq for Color
impl StructuralPartialEq for Color
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more