[][src]Struct footile::Plotter

pub struct Plotter<P> where
    P: Pixel<Chan = Ch8, Alpha = Premultiplied, Gamma = Linear>, 
{ /* fields omitted */ }

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

impl<P> Plotter<P> where
    P: Pixel<Chan = Ch8, Alpha = Premultiplied, Gamma = Linear>, 
[src]

pub fn new(raster: Raster<P>) -> Self[src]

Create a new plotter.

  • raster Raster to draw.

pub fn width(&self) -> u32[src]

Get width in pixels.

pub fn height(&self) -> u32[src]

Get height in pixels.

pub fn set_tolerance(&mut self, t: f32) -> &mut Self[src]

Set tolerance threshold for curve decomposition.

pub fn set_transform(&mut self, t: Transform) -> &mut Self[src]

Set the transform.

pub fn set_join(&mut self, js: JoinStyle) -> &mut Self[src]

Set stroke join style.

  • js Join style.

pub fn fill<T>(&mut self, rule: FillRule, ops: T, clr: P) -> &mut Raster<P> where
    T: IntoIterator,
    T::Item: Borrow<PathOp>, 
[src]

Fill path onto the raster.

  • rule Fill rule.
  • ops PathOp iterator.
  • clr Color to fill.

pub fn stroke<T>(&mut self, ops: T, clr: P) -> &mut Raster<P> where
    T: IntoIterator,
    T::Item: Borrow<PathOp>, 
[src]

Stroke path onto the raster.

  • ops PathOp iterator.
  • clr Color to stroke.

pub fn raster(self) -> Raster<P>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.