Struct bevy_canvas::Path [−]
pub struct Path { /* fields omitted */ }
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| ...
|_________|__________|_________|__________|_________|_________|__________|_
Implementations
impl Path
impl Path
pub fn builder() -> Builder
Creates a Builder to build a path.
pub fn builder_with_attributes(num_attributes: usize) -> BuilderWithAttributes
Creates a BuilderWithAttributes to build a path with custom attributes.
pub fn svg_builder() -> WithSvg<Builder>
Creates an WithSvg to build a path with a rich set of commands.
pub fn new() -> Path
Creates an Empty Path
.
pub fn as_slice(&self) -> PathSlice<'_>
Returns a view on this Path
.
pub fn attributes(&self, endpoint: EndpointId) -> &[f32]
Returns a slice over an endpoint’s custom attributes.
pub fn iter(&self) -> Iter<'_>
Iterates over the entire Path
.
pub fn id_iter(&self) -> IdIter<'_>
Iterates over the endpoint and control point ids of the Path
.
pub fn iter_with_attributes(&self) -> IterWithAttributes<'_>
pub fn transformed<T>(self, transform: &T) -> Path where
T: Transformation<f32>,
T: Transformation<f32>,
Applies a transform to all endpoints and control points of this path and Returns the result.
pub fn reversed(&self) -> Path
Returns a reversed version of this path with edge loops specified in the opposite order.
Trait Implementations
impl AttributeStore for Path
impl AttributeStore for Path
impl<'l> IntoIterator for &'l Path
impl<'l> IntoIterator for &'l Path
impl PositionStore for Path
impl PositionStore for Path
pub fn get_endpoint(&self, id: EndpointId) -> Point2D<f32, UnknownUnit>
pub fn get_control_point(&self, id: ControlPointId) -> Point2D<f32, UnknownUnit>
Auto Trait Implementations
impl RefUnwindSafe for Path
impl RefUnwindSafe for Path
impl UnwindSafe for Path
impl UnwindSafe for Path
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> FromWorld for T where
T: Default,
impl<T> FromWorld for T where
T: Default,
pub fn from_world(_world: &mut World) -> T
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
impl<T> TypeData for T where
T: 'static + Send + Sync + Clone,
pub fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,