Struct dx::foundation::colorspace::Color
source · [−]Expand description
Basic color representation
Fields
red: f32
Red component
green: f32
Green component
blue: f32
Blue component
alpha: f32
Alpha component
Implementations
sourceimpl Color
impl Color
sourcepub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Color
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Color
Create color with floating point components
sourcepub fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Color
pub fn rgba(red: u8, green: u8, blue: u8, alpha: u8) -> Color
Create color with byte components
sourcepub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color
Create solid color with using hsl color space
sourcepub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color
Create solid color with using hsl color space and alpha component
sourcepub fn hsv(hue: f32, saturation: f32, value: f32) -> Color
pub fn hsv(hue: f32, saturation: f32, value: f32) -> Color
Create solid color with using hsv color space
sourcepub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Color
pub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Color
Create solid color with using hsv color space and alpha component
sourcepub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Color
pub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Color
Create solid color with using cmyk color space
sourcepub fn cmyka(
cyan: f32,
magenta: f32,
yellow: f32,
key: f32,
alpha: f32
) -> Color
pub fn cmyka(
cyan: f32,
magenta: f32,
yellow: f32,
key: f32,
alpha: f32
) -> Color
Create solid color with using cmyk color space and alpha component
sourcepub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Color
pub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Color
Create solid color with using cmy color space
sourcepub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Color
pub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Color
Create solid color with using cmy color space and alpha component
sourcepub fn RGB(red: u8, green: u8, blue: u8) -> Color
👎 Deprecated
pub fn RGB(red: u8, green: u8, blue: u8) -> Color
Create solid color with using rgb color space
sourcepub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Color
👎 Deprecated
pub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Color
Create solid color with using lab rgb space and alpha component
sourcepub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Color
👎 Deprecated
pub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Color
Create solid color with using hsl color space
sourcepub fn HSV(hue: f32, saturation: f32, value: f32) -> Color
👎 Deprecated
pub fn HSV(hue: f32, saturation: f32, value: f32) -> Color
Create solid color with using hsv color space
Trait Implementations
sourceimpl GetAlpha<Color> for Color
impl GetAlpha<Color> for Color
sourcefn get_opacity(&self) -> f32
fn get_opacity(&self) -> f32
Retrieve the alpha component as opacity
sourcefn get_transparency(&self) -> f32
fn get_transparency(&self) -> f32
Retrieve the alpha component as transparency
impl ColorTransition for Color
impl Copy for Color
impl NonRadialSpace for Color
impl NonSaturationSpace 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<C> AdjustHue for C where
C: Clone + GetHue + SetHue,
impl<C> AdjustHue for C where
C: Clone + GetHue + SetHue,
sourcefn adjust_hue(self, delta: f32) -> C
fn adjust_hue(self, delta: f32) -> C
Adjust hue component of color with delta
sourcefn complement(self) -> Self
fn complement(self) -> Self
Rotate hue component with 180 degrees
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
sourceimpl<Fr, To> FromColor<Fr> for To where
To: From<Color>,
Fr: Into<Color>,
impl<Fr, To> FromColor<Fr> for To where
To: From<Color>,
Fr: Into<Color>,
sourcefn from_color(from_color: Fr) -> To
fn from_color(from_color: Fr) -> To
Convert from color
sourceimpl<C> GetHue for C where
C: NonRadialSpace,
impl<C> GetHue for C where
C: NonRadialSpace,
sourceimpl<C> GetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
impl<C> GetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
sourcefn get_hsl_saturation(self) -> f32
fn get_hsl_saturation(self) -> f32
Retrieve hsl saturation
sourcefn get_hsv_saturation(self) -> f32
fn get_hsv_saturation(self) -> f32
Set hsv saturation
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
sourceimpl<C> Invert for C where
C: ColorTransition,
impl<C> Invert for C where
C: ColorTransition,
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<C> Saturate for C where
C: Clone + GetRadialSaturation + SetRadialSaturation,
impl<C> Saturate for C where
C: Clone + GetRadialSaturation + SetRadialSaturation,
sourceimpl<C> SetHue for C where
C: NonRadialSpace,
impl<C> SetHue for C where
C: NonRadialSpace,
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
sourceimpl<C> SetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
impl<C> SetRadialSaturation for C where
C: Clone + Copy + FromColor<HslColor> + IntoColor<HslColor> + FromColor<HsvColor> + IntoColor<HsvColor>,
sourcefn set_hsl_saturation(&mut self, saturation: f32) -> C
fn set_hsl_saturation(&mut self, saturation: f32) -> C
Retrieve hsl saturation
sourcefn set_hsv_saturation(&mut self, saturation: f32) -> C
fn set_hsv_saturation(&mut self, saturation: f32) -> C
Set hsv saturation
sourceimpl<C> ToHexString for C where
C: Into<RgbColor> + Clone,
impl<C> ToHexString for C where
C: Into<RgbColor> + Clone,
sourcefn to_hex_string(&self) -> String
fn to_hex_string(&self) -> String
Represents a color as a hexadecimal string