pub struct Plotter { /* private fields */ }
Expand description
Plotter for 2D vector paths.
This is a software vector rasterizer featuring high quality anti-aliasing. Paths can be created using PathBuilder. The plotter contains a Mask of the current plot, which is affected by fill and stroke calls. Using the color_over method will cause a Raster to be created with the same height and width as the mask.
Example
use footile::{PathBuilder, Plotter};
let path = PathBuilder::new().pen_width(3f32)
.move_to(50f32, 34f32)
.cubic_to(4f32, 16f32, 16f32, 28f32, 0f32, 32f32)
.cubic_to(-16f32, -4f32, -4f32, -16f32, 0f32, -32f32)
.close().build();
let mut p = Plotter::new(100, 100);
p.stroke(&path);
Implementations
sourceimpl Plotter
impl Plotter
sourcepub fn new(width: u32, height: u32) -> Plotter
pub fn new(width: u32, height: u32) -> Plotter
Create a new plotter.
width
Width in pixels.height
Height in pixels.
sourcepub fn clear_mask(&mut self) -> &mut Self
pub fn clear_mask(&mut self) -> &mut Self
Clear the mask.
sourcepub fn set_tolerance(&mut self, t: f32) -> &mut Self
pub fn set_tolerance(&mut self, t: f32) -> &mut Self
Set tolerance threshold for curve decomposition.
sourcepub fn set_transform(&mut self, t: Transform) -> &mut Self
pub fn set_transform(&mut self, t: Transform) -> &mut Self
Set the transform.
sourcepub fn fill<'a, T>(&mut self, ops: T, rule: FillRule) -> &mut Selfwhere
T: IntoIterator<Item = &'a PathOp>,
pub fn fill<'a, T>(&mut self, ops: T, rule: FillRule) -> &mut Selfwhere
T: IntoIterator<Item = &'a PathOp>,
Fill path onto the mask.
ops
PathOp iterator.rule
Fill rule.
sourcepub fn stroke<'a, T>(&mut self, ops: T) -> &mut Selfwhere
T: IntoIterator<Item = &'a PathOp>,
pub fn stroke<'a, T>(&mut self, ops: T) -> &mut Selfwhere
T: IntoIterator<Item = &'a PathOp>,
Stroke path onto the mask.
ops
PathOp iterator.
sourcepub fn color_over(&mut self, clr: Color) -> &mut Self
pub fn color_over(&mut self, clr: Color) -> &mut Self
Composite mask with a color onto raster, using “over”.
clr
Color to composite.
Auto Trait Implementations
impl RefUnwindSafe for Plotter
impl Send for Plotter
impl Sync for Plotter
impl Unpin for Plotter
impl UnwindSafe for Plotter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more