Skip to main content

ContourMeasure

Type Alias ContourMeasure 

Source
pub type ContourMeasure = RCHandle<SkContourMeasure>;

Aliased Type§

pub struct ContourMeasure(/* private fields */);

Implementations§

Source§

impl ContourMeasure

Source

pub fn length(&self) -> scalar

Returns the length of the contour.

Source

pub fn pos_tan(&self, distance: scalar) -> Option<(Point, Vector)>

Pins distance to 0 <= distance <= length(), then computes the corresponding position and tangent.

  • distance: distance along the contour.
Source

pub fn get_matrix( &self, distance: scalar, flags: impl Into<Option<MatrixFlags>>, ) -> Option<Matrix>

Pins distance to 0 <= distance <= length(), then computes the corresponding matrix (by calling Self::pos_tan()).

Returns None if there is no path, or a zero-length path was specified.

  • distance: distance along the contour.
  • flags: controls whether position, tangent, or both are computed.
Source

pub fn segment( &self, start_d: scalar, stop_d: scalar, path_builder: &mut PathBuilder, start_with_move_to: bool, ) -> bool

👎Deprecated since 0.94.0: Use get_segment()

Given a start and stop distance, appends the intervening segment(s) to path_builder.

If the segment is zero-length, returns false; otherwise returns true. start_d and stop_d are pinned to legal values (0..length()). If start_d > stop_d, returns false and leaves path_builder untouched.

Begins the segment with a move_to if start_with_move_to is true.

  • start_d: start distance along the contour.
  • stop_d: stop distance along the contour.
  • path_builder: destination that receives the segment.
  • start_with_move_to: whether to begin with move_to.
Source

pub fn get_segment( &self, start_d: scalar, stop_d: scalar, path_builder: &mut PathBuilder, start_with_move_to: bool, ) -> bool

Given a start and stop distance, appends the intervening segment(s) to path_builder.

If the segment is zero-length, returns false; otherwise returns true. start_d and stop_d are pinned to legal values (0..length()). If start_d > stop_d, returns false and leaves path_builder untouched.

Begins the segment with a move_to if start_with_move_to is true.

  • start_d: start distance along the contour.
  • stop_d: stop distance along the contour.
  • path_builder: destination that receives the segment.
  • start_with_move_to: whether to begin with move_to.
Source

pub fn is_closed(&self) -> bool

Returns true if the contour is closed.

Source

pub fn verbs(&self) -> ForwardVerbIterator<'_>

Returns an iterator over measurement data for the contour’s verbs.

Trait Implementations§

Source§

impl Debug for ContourMeasure

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for ContourMeasure

Source§

impl Sync for ContourMeasure