Struct lyon_path::PathCommands
source · pub struct PathCommands { /* private fields */ }
Expand description
The commands of a path encoded in a single array using IDs to refer to endpoints and control points externally.
PathCommands
is a good fit when the a custom endpoint and control point
types are needed or when their the user needs full control over their storage.
Representation
Path commands contains a single array of 32 bits integer values encoding path commands, endpoint IDs or control point IDs.
__________________________________________________________________________
| | | | | | | |
| Begin |EndpointID| Line |EndpointID|Quadratic|ControlPointId|EndpointID| ...
|_______|__________|______|__________|_________|______________|__________|_
Example
use lyon_path::{EndpointId, PathCommands};
let mut cmds = PathCommands::builder();
cmds.begin(EndpointId(0));
cmds.line_to(EndpointId(1));
cmds.line_to(EndpointId(2));
cmds.end(true);
let cmds = cmds.build();
Implementations§
source§impl PathCommands
impl PathCommands
sourcepub fn builder() -> PathCommandsBuilder
pub fn builder() -> PathCommandsBuilder
Creates a PathCommandsBuilder to create path commands.
sourcepub fn as_slice(&self) -> PathCommandsSlice<'_>
pub fn as_slice(&self) -> PathCommandsSlice<'_>
Returns a view on the path commands.
sourcepub fn path_slice<'l, Endpoint, ControlPoint>(
&'l self,
endpoints: &'l [Endpoint],
control_points: &'l [ControlPoint]
) -> CommandsPathSlice<'_, Endpoint, ControlPoint>
pub fn path_slice<'l, Endpoint, ControlPoint>( &'l self, endpoints: &'l [Endpoint], control_points: &'l [ControlPoint] ) -> CommandsPathSlice<'_, Endpoint, ControlPoint>
Returns a view on a path made of these commands with endpoint and control point slices.
sourcepub fn events<'l, Endpoint, ControlPoint>(
&'l self,
endpoints: &'l [Endpoint],
control_points: &'l [ControlPoint]
) -> Events<'_, Endpoint, ControlPoint> ⓘ
pub fn events<'l, Endpoint, ControlPoint>( &'l self, endpoints: &'l [Endpoint], control_points: &'l [ControlPoint] ) -> Events<'_, Endpoint, ControlPoint> ⓘ
Returns an iterator over the path, with endpoints and control points.
sourcepub fn next_event_id_in_path(&self, id: EventId) -> Option<EventId>
pub fn next_event_id_in_path(&self, id: EventId) -> Option<EventId>
Returns the next event id within the path.
sourcepub fn next_event_id_in_sub_path(&self, id: EventId) -> EventId
pub fn next_event_id_in_sub_path(&self, id: EventId) -> EventId
Returns the next event id within the sub-path.
Loops back to the first event after the end of the sub-path.
Trait Implementations§
source§impl Clone for PathCommands
impl Clone for PathCommands
source§fn clone(&self) -> PathCommands
fn clone(&self) -> PathCommands
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more