pub struct Plotter<P>{ /* private fields */ }Expand description
Plotter for 2D vector paths.
This is a software vector rasterizer featuring anti-aliasing. The plotter contains a raster, which is drawn by fill and stroke calls.
§Example
use footile::{Path2D, Plotter};
use pix::rgb::Rgba8p;
use pix::Raster;
let path = Path2D::default()
.pen_width(3.0)
.move_to(50.0, 34.0)
.cubic_to(4.0, 16.0, 16.0, 28.0, 0.0, 32.0)
.cubic_to(-16.0, -4.0, -4.0, -16.0, 0.0, -32.0)
.close()
.finish();
let mut p = Plotter::new(Raster::with_clear(100, 100));
p.stroke(&path, Rgba8p::new(255, 128, 0, 255));Implementations§
Source§impl<P> Plotter<P>
impl<P> Plotter<P>
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<f32>) -> &mut Self
pub fn set_transform(&mut self, t: Transform<f32>) -> &mut Self
Set the transform.
Sourcepub fn fill<T>(&mut self, rule: FillRule, ops: T, clr: P) -> &mut Raster<P>
pub fn fill<T>(&mut self, rule: FillRule, ops: T, clr: P) -> &mut Raster<P>
Fill path onto the raster.
ruleFill rule.opsPathOp iterator.clrColor to fill.
Sourcepub fn stroke<T>(&mut self, ops: T, clr: P) -> &mut Raster<P>
pub fn stroke<T>(&mut self, ops: T, clr: P) -> &mut Raster<P>
Stroke path onto the raster.
opsPathOp iterator.clrColor to stroke.
Sourcepub fn raster_mut(&mut self) -> &mut Raster<P>
pub fn raster_mut(&mut self) -> &mut Raster<P>
Get a mutable reference to the raster.
Sourcepub fn into_raster(self) -> Raster<P>
pub fn into_raster(self) -> Raster<P>
Consume the plotter and get the raster.
Auto Trait Implementations§
impl<P> Freeze for Plotter<P>
impl<P> RefUnwindSafe for Plotter<P>where
P: RefUnwindSafe,
impl<P> Send for Plotter<P>where
P: Send,
impl<P> Sync for Plotter<P>where
P: Sync,
impl<P> Unpin for Plotter<P>
impl<P> UnwindSafe for Plotter<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more