32 lines
823 B
Rust
32 lines
823 B
Rust
use std::borrow::Cow;
|
|
|
|
use csscolorparser::Color;
|
|
use quick_xml::{events::attributes::Attribute, name::QName};
|
|
|
|
use super::WriteElement;
|
|
|
|
/// [feFlood](https://www.w3.org/TR/SVG11/filters.html#feFloodElement)
|
|
#[derive(Debug)]
|
|
pub struct Flood {
|
|
flood_color: Color,
|
|
flood_opacity: f32,
|
|
}
|
|
|
|
impl WriteElement for Flood {
|
|
fn attrs(&self) -> Vec<quick_xml::events::attributes::Attribute> {
|
|
vec![
|
|
Attribute {
|
|
key: QName(b"flood-color"),
|
|
value: Cow::from(self.flood_color.to_hex_string().into_bytes()),
|
|
},
|
|
Attribute {
|
|
key: QName(b"flood-opacity"),
|
|
value: Cow::from(self.flood_opacity.to_string().into_bytes()),
|
|
},
|
|
]
|
|
}
|
|
|
|
fn tag_name(&self) -> &'static str {
|
|
"feFlood"
|
|
}
|
|
}
|