pub struct Plotter<P> where
P: Pixel<Chan = Ch8, Alpha = Premultiplied, Gamma = Linear>, { /* 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
sourceimpl<P> Plotter<P> where
P: Pixel<Chan = Ch8, Alpha = Premultiplied, Gamma = Linear>,
impl<P> Plotter<P> where
P: Pixel<Chan = Ch8, Alpha = Premultiplied, Gamma = Linear>,
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> where
T: IntoIterator,
T::Item: Borrow<PathOp>,
pub fn fill<T>(&mut self, rule: FillRule, ops: T, clr: P) -> &mut Raster<P> where
T: IntoIterator,
T::Item: Borrow<PathOp>,
Fill path onto the raster.
rule
Fill rule.ops
PathOp iterator.clr
Color to fill.
sourcepub fn stroke<T>(&mut self, ops: T, clr: P) -> &mut Raster<P> where
T: IntoIterator,
T::Item: Borrow<PathOp>,
pub fn stroke<T>(&mut self, ops: T, clr: P) -> &mut Raster<P> where
T: IntoIterator,
T::Item: Borrow<PathOp>,
Stroke path onto the raster.
ops
PathOp iterator.clr
Color 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> 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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