pub struct PathBuilder { /* private fields */ }Expand description
Builder for constructing paths from PDF path operators.
Coordinates are transformed through the CTM before storage.
Implementations§
Source§impl PathBuilder
impl PathBuilder
Sourcepub fn stroke(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn stroke(&mut self, gs: &GraphicsState) -> PaintedPath
S operator: stroke the current path.
Paints the path outline using the current stroking color and line width. Clears the current path after painting.
Sourcepub fn close_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn close_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
s operator: close the current subpath, then stroke.
Equivalent to h S.
Sourcepub fn fill(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn fill(&mut self, gs: &GraphicsState) -> PaintedPath
f or F operator: fill the current path using the nonzero winding rule.
Any open subpaths are implicitly closed before filling.
Sourcepub fn fill_even_odd(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn fill_even_odd(&mut self, gs: &GraphicsState) -> PaintedPath
f* operator: fill the current path using the even-odd rule.
Sourcepub fn fill_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn fill_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
B operator: fill then stroke the current path (nonzero winding).
Sourcepub fn fill_even_odd_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn fill_even_odd_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
B* operator: fill (even-odd) then stroke the current path.
Sourcepub fn close_fill_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
pub fn close_fill_and_stroke(&mut self, gs: &GraphicsState) -> PaintedPath
b operator: close, fill (nonzero winding), then stroke.
Equivalent to h B.
Sourcepub fn close_fill_even_odd_and_stroke(
&mut self,
gs: &GraphicsState,
) -> PaintedPath
pub fn close_fill_even_odd_and_stroke( &mut self, gs: &GraphicsState, ) -> PaintedPath
b* operator: close, fill (even-odd), then stroke.
Equivalent to h B*.
Sourcepub fn end_path(&mut self) -> Option<PaintedPath>
pub fn end_path(&mut self) -> Option<PaintedPath>
n operator: end the path without painting.
Discards the current path. Used primarily for clipping paths.
Returns None since no painted path is produced.
Source§impl PathBuilder
impl PathBuilder
Sourcepub fn move_to(&mut self, x: f64, y: f64)
pub fn move_to(&mut self, x: f64, y: f64)
m operator: move to a new point, starting a new subpath.
Sourcepub fn line_to(&mut self, x: f64, y: f64)
pub fn line_to(&mut self, x: f64, y: f64)
l operator: straight line from current point to (x, y).
Sourcepub fn curve_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64)
pub fn curve_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64)
c operator: cubic Bezier curve with three coordinate pairs.
Sourcepub fn curve_to_v(&mut self, x2: f64, y2: f64, x3: f64, y3: f64)
pub fn curve_to_v(&mut self, x2: f64, y2: f64, x3: f64, y3: f64)
v operator: cubic Bezier where first control point equals current point.
Sourcepub fn curve_to_y(&mut self, x1: f64, y1: f64, x3: f64, y3: f64)
pub fn curve_to_y(&mut self, x1: f64, y1: f64, x3: f64, y3: f64)
y operator: cubic Bezier where last control point equals endpoint.
Sourcepub fn close_path(&mut self)
pub fn close_path(&mut self)
h operator: close the current subpath.
Sourcepub fn rectangle(&mut self, x: f64, y: f64, width: f64, height: f64)
pub fn rectangle(&mut self, x: f64, y: f64, width: f64, height: f64)
re operator: append a rectangle as moveto + 3 lineto + closepath.
Sourcepub fn current_point(&self) -> Option<Point>
pub fn current_point(&self) -> Option<Point>
Get the current point (already CTM-transformed).
Sourcepub fn take_and_reset(&mut self) -> Path
pub fn take_and_reset(&mut self) -> Path
Take the accumulated segments as a Path and reset the builder.
After this call, the builder is empty and ready for a new path. The current point and subpath start are also reset.
Trait Implementations§
Source§impl Clone for PathBuilder
impl Clone for PathBuilder
Source§fn clone(&self) -> PathBuilder
fn clone(&self) -> PathBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more