Trait Interpolate

Source
pub trait Interpolate {
    // Required methods
    fn fill_missing_components(&mut self, other: &Self);
    fn premultiply(&mut self);
    fn unpremultiply(&mut self, alpha_multiplier: f32);
    fn interpolate(&self, p1: f32, other: &Self, p2: f32) -> Self;

    // Provided methods
    fn adjust_powerless_components(&mut self) { ... }
    fn adjust_hue(&mut self, _: &mut Self, _: HueInterpolationMethod) { ... }
}
Expand description

A trait that colors implement to support interpolation.

Required Methods§

Source

fn fill_missing_components(&mut self, other: &Self)

Fills missing components (represented as NaN) to match the other color to interpolate with.

Source

fn premultiply(&mut self)

Premultiplies the color by its alpha value.

Source

fn unpremultiply(&mut self, alpha_multiplier: f32)

Un-premultiplies the color by the given alpha multiplier.

Source

fn interpolate(&self, p1: f32, other: &Self, p2: f32) -> Self

Interpolates the color with another using the given amounts of each.

Provided Methods§

Source

fn adjust_powerless_components(&mut self)

Adjusts components that are powerless to be NaN.

Source

fn adjust_hue(&mut self, _: &mut Self, _: HueInterpolationMethod)

Adjusts the color hue according to the given hue interpolation method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§