[−][src]Struct tropy::colour::Hsl
Color represented in HSL
Fields
h: f64
Hue in 0-360 degree
s: f64
Saturation in 0...1 (percent)
l: f64
Luminosity in 0...1 (percent)
Methods
impl HSL
[src]
pub fn from_rgb(rgb: &[u8]) -> HSL
[src]
Convert RGB pixel value to HSL
Expects RGB pixel to be a slice of three u8
s representing the red, green and blue values.
use hsl::HSL; let blue = HSL::from_rgb(&[0, 0, 255]);
Algorithm from go-color by Brandon Thomson bt@brandonthomson.com. (Iternally converts the pixel to RGB before converting it to HSL.)
pub fn to_rgb(&self) -> (u8, u8, u8)
[src]
Convert HSL color to RGB
use hsl::HSL; let cyan = HSL { h: 180_f64, s: 1_f64, l: 0.5_f64 }; assert_eq!(cyan.to_rgb(), (0, 255, 255));
Trait Implementations
impl Debug for HSL
[src]
impl Copy for HSL
[src]
impl Clone for HSL
[src]
fn clone(&self) -> HSL
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialOrd<HSL> for HSL
[src]
fn partial_cmp(&self, other: &HSL) -> Option<Ordering>
[src]
fn lt(&self, other: &HSL) -> bool
[src]
fn le(&self, other: &HSL) -> bool
[src]
fn gt(&self, other: &HSL) -> bool
[src]
fn ge(&self, other: &HSL) -> bool
[src]
impl PartialEq<HSL> for HSL
[src]
impl Default for HSL
[src]
impl From<HSL> for Rgb
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,