[−][src]Struct blend2d::path::Path
A 2D vector path.
Methods
impl Path
[src]
pub fn new() -> Self
[src]
Creates a new empty path.
pub fn with_capacity(n: usize) -> Self
[src]
Creates a new path with space for n elements before having to reallocate.
pub fn clear(&mut self)
[src]
Clears the path.
pub fn shrink_to_fit(&mut self)
[src]
Shrinks the path's allocated capacity down to its currently used size.
pub fn reserve(&mut self, n: usize)
[src]
pub fn try_reserve(&mut self, n: usize) -> Result<(), OutOfMemory>
[src]
Reserves capacity for at least n items.
pub fn len(&self) -> usize
[src]
Returns the current number of vertices in the path.
pub fn capacity(&self) -> usize
[src]
Returns the currently allocated capacity of the path.
pub fn is_empty(&self) -> bool
[src]
Returns true if the path has no vertices.
pub fn command_data(&self) -> &[u8]
[src]
Returns the path's command data.
pub fn vertex_data(&self) -> &[PointD]
[src]
Returns the path's vertex data.
pub fn info_flags(&self) -> Option<PathFlags>
[src]
Returns this path's flags, or None
if its geometry is invalid.
pub fn control_box(&self) -> Option<BoxD>
[src]
Retrieves a bounding box of all vertices and control points.
pub fn bounding_box(&self) -> Option<BoxD>
[src]
Retrieves a bounding box of all on-path vertices and curve extremas.
pub fn figure_range(&self, index: usize) -> Option<Range<usize>>
[src]
Returns the range describing a figure at the given index.
pub fn last_vertex(&self) -> Option<PointD>
[src]
pub fn closest_vertex(
&self,
p: &PointD,
max_distance: f64
) -> Option<(usize, f64)>
[src]
&self,
p: &PointD,
max_distance: f64
) -> Option<(usize, f64)>
pub fn hit_test(&self, p: &PointD, fill_rule: FillRule) -> HitTest
[src]
Hit tests the given point p by respecting the given FillRule
.
pub fn set_vertex_at(&mut self, index: usize, cmd: PathCommand, x: f64, y: f64)
[src]
Sets the vertex at the index to the given PathCommand
and point.
pub fn set_vertex_at_point(
&mut self,
index: usize,
cmd: PathCommand,
point: PointD
)
[src]
&mut self,
index: usize,
cmd: PathCommand,
point: PointD
)
Sets the vertex at the index to the given PathCommand
and point.
impl Path
[src]
pub fn move_to(&mut self, x: f64, y: f64)
[src]
Moves to the point.
pub fn move_to_point(&mut self, point: &PointD)
[src]
Moves to the point.
pub fn line_to(&mut self, x: f64, y: f64)
[src]
Adds a line from the current to the given point to this path.
pub fn line_to_point(&mut self, point: &PointD)
[src]
Adds a line from the current to the given point to this path.
pub fn poly_to(&mut self, poly: &[PointD])
[src]
Adds a polyline (LineTo) of the given points.
pub fn quad_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)
[src]
Adds a quadratic curve to the first and second point.
Matches SVG 'Q' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands
pub fn quad_to_points(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)
[src]
Adds a quadratic curve to the first and second point.
Matches SVG 'Q' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands
pub fn cubic_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64)
[src]
Adds a cubic curve to the first, second and third point.
Matches SVG 'C' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands
pub fn cubic_to_points(&mut self, p1: &PointD, p2: &PointD, p3: &PointD)
[src]
Adds a cubic curve to the first, second and third point.
Matches SVG 'C' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands
pub fn smooth_quad_to(&mut self, x2: f64, y2: f64)
[src]
Adds a smooth quadratic curve to the given point, calculating the first from previous points.
Matches SVG 'T' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands
pub fn smooth_quad_to_point(&mut self, p2: &PointD)
[src]
Adds a smooth quadratic curve to the given point, calculating the first from previous points.
Matches SVG 'T' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands
pub fn smooth_cubic_to(&mut self, x2: f64, y2: f64, x3: f64, y3: f64)
[src]
Adds a smooth cubic curve to the given points, calculating the first from previous points.
Matches SVG 'S' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands
pub fn smooth_cubic_to_points(&mut self, p2: &PointD, p3: &PointD)
[src]
Adds a smooth cubic curve to the given points, calculating the first from previous points.
Matches SVG 'S' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands
pub fn arc_to(
&mut self,
cx: f64,
cy: f64,
rx: f64,
ry: f64,
start: f64,
sweep: f64,
force_move_to: bool
)
[src]
&mut self,
cx: f64,
cy: f64,
rx: f64,
ry: f64,
start: f64,
sweep: f64,
force_move_to: bool
)
Adds an arc to the path.
The center of the arc is specified by c
and radius by r
. Both start
and sweep
angles are in radians. If the last vertex doesn't match the
start of the arc then a Path::line_to
would be emitted before adding the arc.
Pass true
in force_move_to
to always emit Path::move_to
at the beginning of
the arc, which starts a new figure.
pub fn arc_to_points(
&mut self,
cp: &PointD,
rp: &PointD,
start: f64,
sweep: f64,
force_move_to: bool
)
[src]
&mut self,
cp: &PointD,
rp: &PointD,
start: f64,
sweep: f64,
force_move_to: bool
)
Adds an arc to the path.
The center of the arc is specified by cp
and radius by rp
. Both start
and sweep
angles are in radians. If the last vertex doesn't match the
start of the arc then a Path::line_to
would be emitted before adding the arc.
Pass true
in force_move_to
to always emit Path::move_to
at the beginning of
the arc, which starts a new figure.
pub fn arc_quadrant_to(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)
[src]
Adds an arc quadrant (90deg) to the path. The first point specifies the quadrant corner and the last point specifies the end point.
pub fn arc_quadrant_to_points(&mut self, p1: &PointD, p2: &PointD)
[src]
Adds an arc quadrant (90deg) to the path. The first point specifies the quadrant corner and the last point specifies the end point.
pub fn elliptic_arc_to(
&mut self,
rx: f64,
ry: f64,
x_axis_rotation: f64,
large_arc_flag: bool,
sweep_flag: bool,
x1: f64,
y1: f64
)
[src]
&mut self,
rx: f64,
ry: f64,
x_axis_rotation: f64,
large_arc_flag: bool,
sweep_flag: bool,
x1: f64,
y1: f64
)
Adds an elliptic arc to the path that follows the SVG specification.
Matches SVG 'A' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
pub fn elliptic_arc_to_points(
&mut self,
rp: &PointD,
x_axis_rotation: f64,
large_arc_flag: bool,
sweep_flag: bool,
p1: &PointD
)
[src]
&mut self,
rp: &PointD,
x_axis_rotation: f64,
large_arc_flag: bool,
sweep_flag: bool,
p1: &PointD
)
Adds an elliptic arc to the path that follows the SVG specification.
Matches SVG 'A' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
pub fn close(&mut self)
[src]
Closes the current figure.
Matches SVG 'Z' path command:
- https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand
impl Path
[src]
pub fn add_geometry<T: Geometry + ?Sized>(
&mut self,
g: &T,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
)
[src]
&mut self,
g: &T,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
)
Adds a Geometry
to the path.
pub fn add_polygon<R, P>(
&mut self,
p: R,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
) where
R: AsRef<[P]>,
P: Point + Geometry,
[src]
&mut self,
p: R,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
) where
R: AsRef<[P]>,
P: Point + Geometry,
Adds a polygon.
pub fn add_polyline<R, P>(
&mut self,
p: R,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
) where
R: AsRef<[P]>,
P: Point,
[src]
&mut self,
p: R,
matrix: Option<&Matrix2D>,
dir: GeometryDirection
) where
R: AsRef<[P]>,
P: Point,
Adds a polyline.
pub fn add_path(&mut self, other: &Path)
[src]
Adds another path.
pub fn add_path_range<R: RangeBounds<usize>>(&mut self, other: &Path, range: R)
[src]
Adds a part of another path.
pub fn add_translated_path(&mut self, other: &Path, p: &PointD)
[src]
Adds a translated path.
pub fn add_translated_path_range<R: RangeBounds<usize>>(
&mut self,
other: &Path,
range: R,
p: &PointD
)
[src]
&mut self,
other: &Path,
range: R,
p: &PointD
)
Adds a translated part of another path.
pub fn add_transformed_path(&mut self, other: &Path, m: &Matrix2D)
[src]
Adds a transformed path.
pub fn add_transformed_path_range<R: RangeBounds<usize>>(
&mut self,
other: &Path,
range: R,
m: &Matrix2D
)
[src]
&mut self,
other: &Path,
range: R,
m: &Matrix2D
)
Adds a transformed part of another path.
pub fn add_reversed_path(&mut self, other: &Path, mode: PathReverseMode)
[src]
Adds a reversed path.
pub fn add_reversed_path_range<R: RangeBounds<usize>>(
&mut self,
other: &Path,
range: R,
mode: PathReverseMode
)
[src]
&mut self,
other: &Path,
range: R,
mode: PathReverseMode
)
Adds a reversed part of another path.
pub fn add_stroked_path(
&mut self,
other: &Path,
options: &StrokeOptions,
approx: &ApproximationOptions
)
[src]
&mut self,
other: &Path,
options: &StrokeOptions,
approx: &ApproximationOptions
)
Adds a stroked path.
pub fn add_stroked_path_range<R: RangeBounds<usize>>(
&mut self,
other: &Path,
range: R,
options: &StrokeOptions,
approx: &ApproximationOptions
)
[src]
&mut self,
other: &Path,
range: R,
options: &StrokeOptions,
approx: &ApproximationOptions
)
Adds a stroked part of another path.
impl Path
[src]
pub fn translate(&mut self, p: &PointD)
[src]
Translates the whole path by the given point.
pub fn translate_range<R: RangeBounds<usize>>(&mut self, range: R, p: &PointD)
[src]
Translates a part of the path by the given point.
pub fn transform(&mut self, m: &Matrix2D)
[src]
Transforms the whole path by the given transformation matrix.
pub fn transform_range<R: RangeBounds<usize>>(&mut self, range: R, m: &Matrix2D)
[src]
Transforms a part of the path by the given transformation matrix.
pub fn fit_to(&mut self, rect: &RectD, flags: PathFitFlags)
[src]
Fits the whole path into the given rect by taking into account fit flags
passed by PathFitFlags
.
pub fn fit_to_range<R: RangeBounds<usize>>(
&mut self,
range: R,
rect: &RectD,
flags: PathFitFlags
)
[src]
&mut self,
range: R,
rect: &RectD,
flags: PathFitFlags
)
Fits a part of the path specified by the given range into the given rect
by taking into account the given PathFitFlags
.
Trait Implementations
impl DeepClone for Path
[src]
const ASSIGN_DEEP: unsafe extern "C" fn(_: *mut Self::Core, _: *const Self::Core) -> BLResult
[src]
fn clone_deep(&self) -> Self
[src]
Returns a deeply cloned copy of the value.
impl Geometry for Path
[src]
impl PartialEq<Path> for Path
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Clone for Path
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl AsRef<[PointD]> for Path
[src]
impl Default for Path
[src]
impl Drop for Path
[src]
impl Debug for Path
[src]
impl Borrow<[PointD]> for Path
[src]
Auto Trait Implementations
impl Unpin for Path
impl !Sync for Path
impl !Send for Path
impl RefUnwindSafe for Path
impl UnwindSafe for Path
Blanket Implementations
impl<T> ArrayType for T where
T: WrappedBlCore,
[src]
T: WrappedBlCore,
const IMPL_IDX: usize
[src]
unsafe fn push(&mut BLArrayCore, T)
[src]
unsafe fn insert(&mut BLArrayCore, usize, T)
[src]
unsafe fn replace(&mut BLArrayCore, usize, T)
[src]
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, V> SliceConcat<T> for V where
T: Clone,
V: Borrow<[T]>,
[src]
T: Clone,
V: Borrow<[T]>,
type Output = Vec<T>
slice_concat_trait
)The resulting type after concatenation
fn concat(slice: &[V]) -> Vec<T>
[src]
fn join(slice: &[V], sep: &T) -> Vec<T>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,