Trait fdg_img::style::Color

source ·
pub trait Color {
    // Required method
    fn to_backend_color(&self) -> BackendColor;

    // Provided methods
    fn rgb(&self) -> (u8, u8, u8) { ... }
    fn alpha(&self) -> f64 { ... }
    fn mix(&self, value: f64) -> RGBAColor { ... }
    fn to_rgba(&self) -> RGBAColor { ... }
    fn filled(&self) -> ShapeStyle
       where Self: Sized { ... }
    fn stroke_width(&self, width: u32) -> ShapeStyle
       where Self: Sized { ... }
}
Expand description

Any color representation

Required Methods§

source

fn to_backend_color(&self) -> BackendColor

Normalize this color representation to the backend color

Provided Methods§

source

fn rgb(&self) -> (u8, u8, u8)

Convert the RGB representation to the standard RGB tuple

source

fn alpha(&self) -> f64

Get the alpha channel of the color

source

fn mix(&self, value: f64) -> RGBAColor

Mix the color with given opacity

source

fn to_rgba(&self) -> RGBAColor

Convert the color into the RGBA color which is internally used by Plotters

source

fn filled(&self) -> ShapeStylewhere Self: Sized,

Make a filled style form the color

source

fn stroke_width(&self, width: u32) -> ShapeStylewhere Self: Sized,

Make a shape style with stroke width from a color

Implementations on Foreign Types§

source§

impl<T> Color for &Twhere T: Color,

source§

fn to_backend_color(&self) -> BackendColor

Implementors§