use super::*;
use super::super::path::*;
use super::super::edit::*;
use super::super::brush_properties::*;
#[derive(Clone)]
pub struct BrushPropertiesElement {
id: ElementId,
new_properties: BrushProperties
}
impl BrushPropertiesElement {
pub fn new(id: ElementId, new_properties: BrushProperties) -> BrushPropertiesElement {
BrushPropertiesElement {
id: id,
new_properties: new_properties
}
}
pub fn brush_properties<'a>(&'a self) -> &BrushProperties {
&self.new_properties
}
}
impl VectorElement for BrushPropertiesElement {
fn id(&self) -> ElementId {
self.id
}
fn to_path(&self, _properties: &VectorProperties) -> Option<Vec<Path>> {
None
}
fn render(&self, gc: &mut GraphicsPrimitives, properties: &VectorProperties) {
gc.draw_list(properties.brush.prepare_to_render(&self.new_properties));
}
fn update_properties(&self, properties: &mut VectorProperties) {
properties.brush_properties = self.new_properties.clone();
}
}
impl Into<Vector> for BrushPropertiesElement {
#[inline]
fn into(self) -> Vector {
Vector::BrushProperties(self)
}
}