pub struct Path { /* private fields */ }
Expand description
Collection of the SubPath treated as a single unit. Represents the same concept as an SVG path
Implementations§
source§impl Path
impl Path
sourcepub fn winding_at(&self, point: impl Into<Point>) -> i32
pub fn winding_at(&self, point: impl Into<Point>) -> i32
Calculate winding number of a point
sourcepub fn builder() -> PathBuilder
pub fn builder() -> PathBuilder
Convenience method to create PathBuilder
sourcepub fn into_builder(self) -> PathBuilder
pub fn into_builder(self) -> PathBuilder
Convert path into a path builder so it can be extended
sourcepub fn segments_count(&self) -> usize
pub fn segments_count(&self) -> usize
Number of segments in the path
sourcepub fn stroke(&self, style: StrokeStyle) -> Path
pub fn stroke(&self, style: StrokeStyle) -> Path
Stroke path
Stroked path is the path constructed from original by offsetting by distance/2
and
joining it with the path offset by -distance/2
.
sourcepub fn flatten(
&self,
tr: Transform,
flatness: Scalar,
close: bool
) -> impl Iterator<Item = Line> + '_
pub fn flatten( &self, tr: Transform, flatness: Scalar, close: bool ) -> impl Iterator<Item = Line> + '_
Convert path to an iterator over line segments
sourcepub fn bbox(&self, tr: Transform) -> Option<BBox>
pub fn bbox(&self, tr: Transform) -> Option<BBox>
Bounding box of the path after provided transformation is applied.
sourcepub fn size(&self, tr: Transform) -> Option<(Size, Transform, Point)>
pub fn size(&self, tr: Transform) -> Option<(Size, Transform, Point)>
Calculate size of the image required to render the path
Returns:
- Size of the image
- Transformation required
- Position of lowest x and y point of the image
sourcepub fn fill<R, P, I>(
&self,
rasterizer: R,
tr: Transform,
fill_rule: FillRule,
paint: P,
img: I
) -> Iwhere
R: Rasterizer,
P: Paint,
I: ImageMut<Pixel = LinColor>,
pub fn fill<R, P, I>( &self, rasterizer: R, tr: Transform, fill_rule: FillRule, paint: P, img: I ) -> Iwhere R: Rasterizer, P: Paint, I: ImageMut<Pixel = LinColor>,
Fill path with the provided paint
sourcepub fn mask<R, I>(
&self,
rasterizer: R,
tr: Transform,
fill_rule: FillRule,
img: I
) -> Iwhere
R: Rasterizer,
I: ImageMut<Pixel = Scalar>,
pub fn mask<R, I>( &self, rasterizer: R, tr: Transform, fill_rule: FillRule, img: I ) -> Iwhere R: Rasterizer, I: ImageMut<Pixel = Scalar>,
Rasterize mast for the path in into a provided image.
Everything that is outside of the image will be cropped. Image is assumed to contain zeros.
sourcepub fn write_svg_path(&self, out: impl Write) -> Result<()>
pub fn write_svg_path(&self, out: impl Write) -> Result<()>
Save path in SVG path format.
sourcepub fn read_svg_path(input: impl Read) -> Result<Self>
pub fn read_svg_path(input: impl Read) -> Result<Self>
Load path from SVG path representation
sourcepub fn verbose_debug(&self) -> PathVerboseDebug<'_>
pub fn verbose_debug(&self) -> PathVerboseDebug<'_>
Returns struct that prints command per line on debug formatting.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Path
impl<'de> Deserialize<'de> for Path
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
source§impl Extend<SubPath> for Path
impl Extend<SubPath> for Path
source§fn extend<T: IntoIterator<Item = SubPath>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = SubPath>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)