Struct palette::Luma [] [src]

pub struct Luma {
    pub luma: f32,
    pub alpha: f32,
}

Linear luminance with an alpha component.

Luma is a purely gray scale color space, which is included more for completeness than anything else, and represents how bright a color is perceived to be. It's basically the Y component of CIE XYZ. The lack of any form of hue representation limits the set of operations that can be performed on it.

Fields

luma: f32

The lightness of the color. 0.0 is black and 1.0 is white.

alpha: f32

The transparency of the color. 0.0 is completely transparent and 1.0 is completely opaque.

Methods

impl Luma
[src]

fn y(luma: f32) -> Luma

Linear luminance.

fn ya(luma: f32, alpha: f32) -> Luma

Linear luminance with transparency.

fn y8(luma: u8) -> Luma

Linear luminance from an 8 bit value.

fn ya8(luma: u8, alpha: u8) -> Luma

Linear luminance and transparency from 8 bit values.

Trait Implementations

impl PartialEq for Luma
[src]

fn eq(&self, __arg_0: &Luma) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Luma) -> bool

This method tests for !=.

impl Debug for Luma
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Copy for Luma
[src]

impl Clone for Luma
[src]

fn clone(&self) -> Luma

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl ColorSpace for Luma
[src]

fn is_valid(&self) -> bool

Check if the color's components are within the expected ranges.

fn clamp(&self) -> Luma

Return a new color where the components has been clamped to the nearest valid values. Read more

fn clamp_self(&mut self)

Clamp the color's components to the nearest valid values.

impl Mix for Luma
[src]

fn mix(&self, other: &Luma, factor: f32) -> Luma

Mix the color with an other color, by factor. Read more

impl Shade for Luma
[src]

fn lighten(&self, amount: f32) -> Luma

Lighten the color by amount.

fn darken(&self, amount: f32) -> Self

Darken the color by amount.

impl Default for Luma
[src]

fn default() -> Luma

Returns the "default value" for a type. Read more

impl Add<Luma> for Luma
[src]

type Output = Luma

The resulting type after applying the + operator

fn add(self, other: Luma) -> Luma

The method for the + operator

impl Add<f32> for Luma
[src]

type Output = Luma

The resulting type after applying the + operator

fn add(self, c: f32) -> Luma

The method for the + operator

impl Sub<Luma> for Luma
[src]

type Output = Luma

The resulting type after applying the - operator

fn sub(self, other: Luma) -> Luma

The method for the - operator

impl Sub<f32> for Luma
[src]

type Output = Luma

The resulting type after applying the - operator

fn sub(self, c: f32) -> Luma

The method for the - operator

impl Mul<Luma> for Luma
[src]

type Output = Luma

The resulting type after applying the * operator

fn mul(self, other: Luma) -> Luma

The method for the * operator

impl Mul<f32> for Luma
[src]

type Output = Luma

The resulting type after applying the * operator

fn mul(self, c: f32) -> Luma

The method for the * operator

impl Div<Luma> for Luma
[src]

type Output = Luma

The resulting type after applying the / operator

fn div(self, other: Luma) -> Luma

The method for the / operator

impl Div<f32> for Luma
[src]

type Output = Luma

The resulting type after applying the / operator

fn div(self, c: f32) -> Luma

The method for the / operator

impl From<Color> for Luma
[src]

fn from(color: Color) -> Luma

Performs the conversion.

impl From<Rgb> for Luma
[src]

fn from(rgb: Rgb) -> Luma

Performs the conversion.

impl From<Xyz> for Luma
[src]

fn from(xyz: Xyz) -> Luma

Performs the conversion.

impl From<Lab> for Luma
[src]

fn from(lab: Lab) -> Luma

Performs the conversion.

impl From<Lch> for Luma
[src]

fn from(lch: Lch) -> Luma

Performs the conversion.

impl From<Hsv> for Luma
[src]

fn from(hsv: Hsv) -> Luma

Performs the conversion.

impl From<Hsl> for Luma
[src]

fn from(hsl: Hsl) -> Luma

Performs the conversion.