use super::*;
use super::super::path::*;
use super::super::edit::*;
use super::super::brush::*;
use std::sync::*;
#[derive(Clone)]
pub struct BrushElement {
id: ElementId,
points: Arc<Vec<BrushPoint>>,
}
impl BrushElement {
pub fn new(id: ElementId, points: Arc<Vec<BrushPoint>>) -> BrushElement {
BrushElement {
id: id,
points: points
}
}
pub fn points(&self) -> Arc<Vec<BrushPoint>> {
Arc::clone(&self.points)
}
}
impl VectorElement for BrushElement {
fn id(&self) -> ElementId {
self.id
}
fn render(&self, gc: &mut GraphicsPrimitives, properties: &VectorProperties) {
gc.draw_list(properties.brush.render_brush(&properties.brush_properties, &self.points))
}
fn to_path(&self, properties: &VectorProperties) -> Option<Vec<Path>> {
Some(vec![Path::from_drawing(properties.brush.render_brush(&properties.brush_properties, &self.points))])
}
}
impl Into<Vector> for BrushElement {
#[inline]
fn into(self) -> Vector {
Vector::BrushStroke(self)
}
}