Struct batbox_color::Hsla

source ·
#[repr(C)]
pub struct Hsla<T: ColorComponent> { pub h: T, pub s: T, pub l: T, pub a: T, }
Expand description

HSLA color. Convert into/from Rgba via the From and Into traits.

Fields§

§h: T

Hue

§s: T

Saturation

§l: T

Lightness

§a: T

Alpha (opacity)

Implementations§

source§

impl<T: ColorComponent> Hsla<T>

source

pub fn new(h: T, s: T, l: T, a: T) -> Self

Construct a new Hsva value

source

pub fn map<F: Fn(T) -> U, U: ColorComponent>(self, f: F) -> Hsla<U>

Map all component values using same function

source

pub fn convert<U: ColorComponent>(self) -> Hsla<U>

Convert color component type

Trait Implementations§

source§

impl<T: ColorComponent + Approx> Approx for Hsla<T>

source§

fn approx_distance_to(&self, other: &Self) -> f32

Get an approximated distance between two values
source§

fn approx_eq(&self, other: &Self) -> bool

Check if values are approximately equal using DEFAULT_EPS
source§

fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool

Check if values are approximately equal using supplied eps value
source§

impl<T: Clone + ColorComponent> Clone for Hsla<T>

source§

fn clone(&self) -> Hsla<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + ColorComponent> Debug for Hsla<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C1: ColorComponent, C2: ColorComponent> From<Hsla<C1>> for Rgba<C2>

source§

fn from(hsl: Hsla<C1>) -> Self

Converts to this type from the input type.
source§

impl<C1: ColorComponent, C2: ColorComponent> From<Rgba<C1>> for Hsla<C2>

source§

fn from(rgb: Rgba<C1>) -> Self

Converts to this type from the input type.
source§

impl<T: PartialEq + ColorComponent> PartialEq for Hsla<T>

source§

fn eq(&self, other: &Hsla<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Copy + ColorComponent> Copy for Hsla<T>

source§

impl<T: Eq + ColorComponent> Eq for Hsla<T>

source§

impl<T: ColorComponent> StructuralEq for Hsla<T>

source§

impl<T: ColorComponent> StructuralPartialEq for Hsla<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Hsla<T>
where T: RefUnwindSafe,

§

impl<T> Send for Hsla<T>
where T: Send,

§

impl<T> Sync for Hsla<T>
where T: Sync,

§

impl<T> Unpin for Hsla<T>
where T: Unpin,

§

impl<T> UnwindSafe for Hsla<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V