[−][src]Struct lyon_path::Path
A simple path data structure.
Custom attributes
Paths can store a fixed number of extra f32
values per endpoint, called
"custom attributes" or "interpolated attributes" through the documentation.
These can be handy to represent arbitrary attributes such as variable colors,
line width, etc.
See also:
Representation
Paths contain two buffers:
- a buffer of commands (Begin, Line, Quadratic, Cubic, Close or End),
- and a buffer of pairs of floats that can be endpoints control points or custom attributes.
The order of storage for points is determined by the sequence of commands. Custom attributes (if any) always directly follow endpoints. If there is an odd number of attributes, the last float of the each attribute sequence is set to zero and is not used.
__________________________
| | | |
| Begin | Line |Quadratic| ...
|_______|______|_________|_
__________________________________________________________________________
| | | | | | | |
|start x,y|attributes| to x, y |attributes|ctrl x,y | to x, y |attributes| ...
|_________|__________|_________|__________|_________|_________|__________|_
Methods
impl Path
[src]
pub fn builder() -> Builder
[src]
Creates a Builder to build a path.
pub fn builder_with_attributes(num_attributes: usize) -> BuilderWithAttributes
[src]
Creates a BuilderWithAttributes to build a path with custom attributes.
pub fn new() -> Path
[src]
Creates an Empty Path
.
pub fn as_slice(&self) -> PathSlice
[src]
Returns a view on this Path
.
pub fn attributes(&self, endpoint: EndpointId) -> &[f32]
[src]
Returns a slice over an endpoint's custom attributes.
ⓘImportant traits for Iter<'l>pub fn iter(&self) -> Iter
[src]
Iterates over the entire Path
.
ⓘImportant traits for IdIter<'l>pub fn id_iter(&self) -> IdIter
[src]
Iterates over the endpoint and control point ids of the Path
.
ⓘImportant traits for IterWithAttributes<'l>pub fn iter_with_attributes(&self) -> IterWithAttributes
[src]
pub fn transformed<T: Transformation<f32>>(&self, transform: &T) -> Self
[src]
Applies a transform to all endpoints and control points of this path and Returns the result.
pub fn reversed(&self) -> Self
[src]
Reversed version of this path with edge loops are specified in the opposite order.
pub fn merge(&self, other: &Self) -> Self
[src]
Concatenate two paths.
They must have the same number of custom attributes.
Trait Implementations
impl AttributeStore for Path
[src]
fn get(&self, id: EndpointId) -> &[f32]
[src]
fn num_attributes(&self) -> usize
[src]
impl Clone for Path
[src]
impl Debug for Path
[src]
impl Default for Path
[src]
impl Index<ControlPointId> for Path
[src]
type Output = Point
The returned type after indexing.
fn index(&self, id: ControlPointId) -> &Point
[src]
impl Index<EndpointId> for Path
[src]
impl<'l> Into<PathSlice<'l>> for &'l Path
[src]
impl<'l> IntoIterator for &'l Path
[src]
type Item = PathEvent
The type of the elements being iterated over.
type IntoIter = Iter<'l>
Which kind of iterator are we turning this into?
ⓘImportant traits for Iter<'l>fn into_iter(self) -> Iter<'l>
[src]
impl PositionStore for Path
[src]
fn get_endpoint(&self, id: EndpointId) -> Point
[src]
fn get_control_point(&self, id: ControlPointId) -> Point
[src]
Auto Trait Implementations
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,