Struct rasterize::LinColor

source ·
pub struct LinColor(/* private fields */);
Expand description

Alpha premultiplied RGBA color in the linear color space (no gamma correction)

Implementations§

source§

impl LinColor

source

pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self

source

pub fn red(self) -> f32

source

pub fn green(self) -> f32

source

pub fn blue(self) -> f32

source

pub fn alpha(self) -> f32

source

pub fn distance(self, other: Self) -> f32

source

pub fn unmultiply(self) -> f32x4

Linear color is by default pre-multiplied by alpha, this function removes pre-multiplication.

Trait Implementations§

source§

impl Add for LinColor

§

type Output = LinColor

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Clone for LinColor

source§

fn clone(&self) -> LinColor

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 Color for LinColor

source§

fn to_rgba(self) -> [u8; 4]

Convert color to sRGBA list
source§

fn blend_over(self, other: Self) -> Self

Blend other color on top of this color
source§

fn with_alpha(self, alpha: Scalar) -> Self

Override alpha component of the color
source§

fn lerp(self, other: Self, t: f32) -> Self

Linear interpolation between self and other colors.
source§

fn to_rgb(self) -> [u8; 3]

Convert color to sRGB list (alpha is discarded)
source§

fn luma(self) -> f32

Calculate LUMA of the color.
source§

fn best_contrast(self, c0: Self, c1: Self) -> Self

Pick color that produces the best contrast with self
source§

impl Debug for LinColor

source§

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

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

impl Default for LinColor

source§

fn default() -> LinColor

Returns the “default value” for a type. Read more
source§

impl Display for LinColor

source§

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

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

impl From<LinColor> for [f32; 4]

source§

fn from(color: LinColor) -> Self

Converts to this type from the input type.
source§

impl From<LinColor> for RGBA

source§

fn from(lin: LinColor) -> Self

Converts to this type from the input type.
source§

impl From<RGBA> for LinColor

source§

fn from(color: RGBA) -> Self

Converts to this type from the input type.
source§

impl FromStr for LinColor

§

type Err = ColorError

The associated error which can be returned from parsing.
source§

fn from_str(color: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Mul<f32> for LinColor

§

type Output = LinColor

The resulting type after applying the * operator.
source§

fn mul(self, scale: f32) -> Self::Output

Performs the * operation. Read more
source§

impl Paint for LinColor

source§

fn at(&self, _: Point) -> LinColor

source§

fn units(&self) -> Option<Units>

source§

fn transform(&self) -> Transform

source§

fn to_json(&self) -> Result<Value, SvgParserError>

Convert paint to JSON value
source§

impl PartialEq for LinColor

source§

fn eq(&self, other: &LinColor) -> 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 Zeroable for LinColor

source§

fn zeroed() -> Self

source§

impl Copy for LinColor

source§

impl Pod for LinColor

source§

impl StructuralPartialEq for LinColor

Auto Trait Implementations§

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> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
source§

impl<T> AnyBitPattern for T
where T: Pod,

source§

impl<T> NoUninit for T
where T: Pod,