[][src]Struct geopattern::color::Color

pub struct Color { /* fields omitted */ }

Color is a single color object

Methods

impl Color[src]

pub fn new(r: f64, g: f64, b: f64) -> Color[src]

create new colors

pub fn new_hcl(h: f64, c: f64, l: f64) -> Color[src]

create new colors from hcl color space

pub fn hex(s: &str) -> Result<Color, ColorError>[src]

convert a hex string ("#abc", "#fedcba") into a Color object

pub fn rgb(&self) -> (f64, f64, f64)[src]

get r, g, b for this object

pub fn almost_equal(&self, other: &Self) -> bool[src]

check if two colors are almost same

this means that the total difference is less than 3 * DELTA

pub fn linear_rgb(&self) -> (f64, f64, f64)[src]

linear RGB representation for the color

pub fn xyz(&self) -> (f64, f64, f64)[src]

XYZ representation for the color

http://www.sjbrown.co.uk/2004/05/14/gamma-correct-rendering/ https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L420

pub fn lab(&self) -> (f64, f64, f64)[src]

LAB representation for the color

http://en.wikipedia.org/wiki/Lab_color_space#CIELAB-CIEXYZ_conversions https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L501

pub fn hcl(&self) -> (f64, f64, f64)[src]

HCL space values

http://www.hunterlab.com/appnotes/an09_96a.pdf https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L745

pub fn hcl_to_lab(h: f64, c: f64, l: f64) -> (f64, f64, f64)[src]

https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L773

pub fn lab_to_xyz(l: f64, a: f64, b: f64) -> (f64, f64, f64)[src]

https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L528

pub fn xyz_to_linear_rgb(x: f64, y: f64, z: f64) -> (f64, f64, f64)[src]

https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L402

pub fn xyz_to_rgb(x: f64, y: f64, z: f64) -> (f64, f64, f64)[src]

https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go#L402

Trait Implementations

impl Debug for Color[src]

Auto Trait Implementations

impl Send for Color

impl Sync for Color

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.