pub type PathMeasure = Handle<SkPathMeasure>;
Aliased Type§
pub struct PathMeasure(/* private fields */);
Implementations§
Source§impl PathMeasure
Warning: Even if you pass in a PathMeasure
with multiple contours, most of this struct’s functions, including length
only return the value for the first contour on the path (which is why they aren’t const
). You must exhaust PathMeasure::next_contour
.
impl PathMeasure
Warning: Even if you pass in a PathMeasure
with multiple contours, most of this struct’s functions, including length
only return the value for the first contour on the path (which is why they aren’t const
). You must exhaust PathMeasure::next_contour
.
use skia_safe::{PathMeasure, Point, Path};
use std::f64::consts::PI;
let mut path = Path::circle((0., 0.), 10.0, None);
path.add_path(&Path::circle((100., 100.), 27.0, None), Point::default(), None);
let mut measure = PathMeasure::new(&path, false, None);
let mut lengths = vec![measure.length()];
while measure.next_contour() {
lengths.push(measure.length());
}
assert_eq!(*lengths.first().unwrap() as i64, (2. * PI * 10.0) as i64);
assert_eq!(*lengths.get(1).unwrap() as i64, (2. * PI * 27.0) as i64);
eprintln!("Circle lengths: {:?}", &lengths);
pub fn new( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self
pub fn from_path( path: &Path, force_closed: bool, res_scale: impl Into<Option<scalar>>, ) -> Self
👎Deprecated since 0.48.0: Use PathMeasure::new
pub fn set_path(&mut self, path: &Path, force_closed: bool) -> &mut Self
pub fn length(&mut self) -> scalar
pub fn pos_tan(&mut self, distance: scalar) -> Option<(Point, Vector)>
pub fn matrix( &mut self, distance: scalar, flags: impl Into<Option<MatrixFlags>>, ) -> Option<Matrix>
👎Deprecated since 0.88.0: Use get_matrix()
pub fn get_matrix( &mut self, distance: scalar, matrix: &mut Matrix, flags: impl Into<Option<MatrixFlags>>, ) -> bool
pub fn segment( &mut self, start_d: scalar, stop_d: scalar, start_with_move_to: bool, ) -> Option<Path>
👎Deprecated since 0.88.0: Use get_segment()