Skip to main content

ColorSpace

Trait ColorSpace 

Source
pub trait ColorSpace: Copy + Sized {
    type Component: Copy;

    // Required methods
    fn to_rgb(self) -> RgbColor;
    fn from_rgb(rgb: RgbColor) -> Self;
}
Expand description

A color space that can convert to and from sRGB.

Render backends can accept a concrete color space and lower it to their native paint operators. RGB-oriented outputs keep using RgbColor, while print-oriented outputs such as EPS/PDF can preserve CmykColor.

Required Associated Types§

Source

type Component: Copy

Component storage used by this color space.

Required Methods§

Source

fn to_rgb(self) -> RgbColor

Converts this color to sRGB.

Source

fn from_rgb(rgb: RgbColor) -> Self

Converts an sRGB color into this color space.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§