Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1.2 kB · 35 lines
Rust
at main
123456789101112131415161718192021222324252627282930313233343536use super::CSSRenderable;use crate::{ColorMapping, Fill};
impl CSSRenderable for Fill { fn render_to_css_filled(&self, colormap: &ColorMapping) -> String { match self { Fill::Solid(color) => { format!("fill: {};", color.render(colormap)) } Fill::Translucent(color, opacity) => { format!("fill: {}; opacity: {};", color.render(colormap), opacity) } Fill::Dotted(..) | Fill::Hatches(..) => { format!("fill: url(#{});", self.pattern_id()) } } }
fn render_to_css_stroked(&self, colormap: &ColorMapping) -> String { match self { Fill::Solid(color) => { format!("stroke: {}; fill: transparent;", color.render(colormap)) } Fill::Translucent(color, opacity) => { format!( "stroke: {}; opacity: {}; fill: transparent;", color.render(colormap), opacity ) } Fill::Dotted(..) => unimplemented!(), Fill::Hatches(..) => unimplemented!(), } }}