[−][src]Struct regenboog::RgbaU8
A type which represents a color.
This color is defined by four components:
- red
- green
- blue
- alpha
Fields
red: u8
The red component
green: u8
The green component
blue: u8
The blue component
alpha: u8
The alpha component
Implementations
impl RgbaU8
[src]
pub const WHITE: RgbaU8
[src]
Pure white
pub const BLACK: RgbaU8
[src]
Pure black
pub const RED: RgbaU8
[src]
Red
pub const GREEN: RgbaU8
[src]
Green
pub const BLUE: RgbaU8
[src]
Blue
pub const fn rgb(red: u8, green: u8, blue: u8) -> RgbaU8
[src]
Construct a color from its red, green and blue components.
The alpha value is set to 255.
Examples
let swag_color = RgbaU8::rgb(160, 32, 240); assert_eq!(swag_color.red , 160); assert_eq!(swag_color.green, 32 ); assert_eq!(swag_color.blue , 240); assert_eq!(swag_color.alpha, 255);
pub const fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> RgbaU8
[src]
Construct a color from its red, green, blue and alpha components.
Examples
let swag_color_transparent = RgbaU8::rgba(160, 32, 240, 200); assert_eq!(swag_color_transparent.red , 160); assert_eq!(swag_color_transparent.green, 32 ); assert_eq!(swag_color_transparent.blue , 240); assert_eq!(swag_color_transparent.alpha, 200);
pub const fn with_red(self, red: u8) -> RgbaU8
[src]
Get a new color with the specified red
component.
Examples
let yellow = RgbaU8::GREEN.with_red(255); assert_eq!(yellow, RgbaU8::rgb(255, 255, 0));
pub const fn with_green(self, green: u8) -> RgbaU8
[src]
Get a new color with the specified green
component.
Examples
let cyan = RgbaU8::BLUE.with_green(255); assert_eq!(cyan, RgbaU8::rgb(0, 255, 255));
pub const fn with_blue(self, blue: u8) -> RgbaU8
[src]
Get a new color with the specified blue
component.
Examples
let magenta = RgbaU8::BLUE.with_red(255); assert_eq!(magenta, RgbaU8::rgb(255, 0, 255));
pub const fn with_alpha(self, alpha: u8) -> RgbaU8
[src]
Get a new color with the specified alpha
component.
Examples
let transparent_blue = RgbaU8::BLUE.with_alpha(100); assert_eq!(transparent_blue, RgbaU8::rgba(0, 0, 255, 100));
Trait Implementations
impl Clone for RgbaU8
[src]
impl Copy for RgbaU8
[src]
impl Debug for RgbaU8
[src]
impl Eq for RgbaU8
[src]
impl From<[f32; 3]> for RgbaU8
[src]
impl From<[f32; 4]> for RgbaU8
[src]
impl From<[u8; 3]> for RgbaU8
[src]
impl From<[u8; 4]> for RgbaU8
[src]
impl From<RgbaU8> for [u8; 3]
[src]
impl From<RgbaU8> for [u8; 4]
[src]
impl From<RgbaU8> for [f32; 3]
[src]
impl From<RgbaU8> for [f32; 4]
[src]
impl Hash for RgbaU8
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for RgbaU8
[src]
fn cmp(&self, other: &RgbaU8) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<RgbaU8> for RgbaU8
[src]
impl PartialOrd<RgbaU8> for RgbaU8
[src]
fn partial_cmp(&self, other: &RgbaU8) -> Option<Ordering>
[src]
fn lt(&self, other: &RgbaU8) -> bool
[src]
fn le(&self, other: &RgbaU8) -> bool
[src]
fn gt(&self, other: &RgbaU8) -> bool
[src]
fn ge(&self, other: &RgbaU8) -> bool
[src]
impl StructuralEq for RgbaU8
[src]
impl StructuralPartialEq for RgbaU8
[src]
Auto Trait Implementations
impl RefUnwindSafe for RgbaU8
impl Send for RgbaU8
impl Sync for RgbaU8
impl Unpin for RgbaU8
impl UnwindSafe for RgbaU8
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>,