Trait ColorSpace

Source
pub trait ColorSpace {
    // Required methods
    fn components(&self) -> (f32, f32, f32, f32);
    fn channels(&self) -> (&'static str, &'static str, &'static str);
    fn types(&self) -> (ChannelType, ChannelType, ChannelType);
    fn resolve_missing(&self) -> Self;
    fn resolve(&self) -> Self;
}
Expand description

A trait for color spaces.

Required Methods§

Source

fn components(&self) -> (f32, f32, f32, f32)

Returns the raw color component values.

Source

fn channels(&self) -> (&'static str, &'static str, &'static str)

Returns the channel names for this color space.

Source

fn types(&self) -> (ChannelType, ChannelType, ChannelType)

Returns the channel types for this color space.

Source

fn resolve_missing(&self) -> Self

Resolves missing color components (e.g. none keywords) in the color.

Source

fn resolve(&self) -> Self

Returns a resolved color by replacing missing (i.e. none) components with zero, and performing gamut mapping to ensure the color can be represented within the color space.

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§