pub type PathCommand = GenericShapeCommand<CSSFloat, CSSFloat>;
Expand description
The SVG path command. The fields of these commands are self-explanatory, so we skip the documents. Note: the index of the control points, e.g. control1, control2, are mapping to the control points of the Bézier curve in the spec.
https://www.w3.org/TR/SVG11/paths.html#PathData
Aliased Type§
enum PathCommand {
Move {
by_to: ByTo,
point: CoordinatePair<f32>,
},
Line {
by_to: ByTo,
point: CoordinatePair<f32>,
},
HLine {
by_to: ByTo,
x: f32,
},
VLine {
by_to: ByTo,
y: f32,
},
CubicCurve {
by_to: ByTo,
point: CoordinatePair<f32>,
control1: CoordinatePair<f32>,
control2: CoordinatePair<f32>,
},
QuadCurve {
by_to: ByTo,
point: CoordinatePair<f32>,
control1: CoordinatePair<f32>,
},
SmoothCubic {
by_to: ByTo,
point: CoordinatePair<f32>,
control2: CoordinatePair<f32>,
},
SmoothQuad {
by_to: ByTo,
point: CoordinatePair<f32>,
},
Arc {
by_to: ByTo,
point: CoordinatePair<f32>,
radii: CoordinatePair<f32>,
arc_sweep: ArcSweep,
arc_size: ArcSize,
rotate: f32,
},
Close,
}
Variants§
Move
The move command.
Line
The line command.
HLine
The hline command.
VLine
The vline command.
CubicCurve
The cubic Bézier curve command.
QuadCurve
The quadratic Bézier curve command.
SmoothCubic
The smooth command.
SmoothQuad
The smooth quadratic Bézier curve command.
Arc
The arc command.
Close
The closepath command.
Implementations§
source§impl PathCommand
impl PathCommand
sourcefn normalize(&self, state: &mut PathTraversalState) -> Self
fn normalize(&self, state: &mut PathTraversalState) -> Self
Create a normalized copy of this PathCommand. Absolute commands will be copied as-is while for relative commands an equivalent absolute command will be returned.
See discussion: https://github.com/w3c/svgwg/issues/321
sourcefn to_css_for_svg<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere
W: Write,
fn to_css_for_svg<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere W: Write,
The serialization of the svg path.
Trait Implementations§
source§impl<Angle, LengthPercentage> Animate for GenericShapeCommand<Angle, LengthPercentage>where
Angle: Animate,
LengthPercentage: Animate,
impl<Angle, LengthPercentage> Animate for GenericShapeCommand<Angle, LengthPercentage>where Angle: Animate, LengthPercentage: Animate,
source§impl<Angle: Clone, LengthPercentage: Clone> Clone for GenericShapeCommand<Angle, LengthPercentage>
impl<Angle: Clone, LengthPercentage: Clone> Clone for GenericShapeCommand<Angle, LengthPercentage>
source§fn clone(&self) -> GenericShapeCommand<Angle, LengthPercentage>
fn clone(&self) -> GenericShapeCommand<Angle, LengthPercentage>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Angle, LengthPercentage> ComputeSquaredDistance for GenericShapeCommand<Angle, LengthPercentage>where
Angle: ComputeSquaredDistance,
LengthPercentage: ComputeSquaredDistance,
impl<Angle, LengthPercentage> ComputeSquaredDistance for GenericShapeCommand<Angle, LengthPercentage>where Angle: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance,
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
source§impl<Angle: Debug, LengthPercentage: Debug> Debug for GenericShapeCommand<Angle, LengthPercentage>
impl<Angle: Debug, LengthPercentage: Debug> Debug for GenericShapeCommand<Angle, LengthPercentage>
source§impl<'de, Angle, LengthPercentage> Deserialize<'de> for GenericShapeCommand<Angle, LengthPercentage>where
Angle: Deserialize<'de>,
LengthPercentage: Deserialize<'de>,
impl<'de, Angle, LengthPercentage> Deserialize<'de> for GenericShapeCommand<Angle, LengthPercentage>where Angle: Deserialize<'de>, LengthPercentage: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<Angle, LengthPercentage> MallocSizeOf for GenericShapeCommand<Angle, LengthPercentage>where
Angle: MallocSizeOf,
LengthPercentage: MallocSizeOf,
impl<Angle, LengthPercentage> MallocSizeOf for GenericShapeCommand<Angle, LengthPercentage>where Angle: MallocSizeOf, LengthPercentage: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl<Angle: PartialEq, LengthPercentage: PartialEq> PartialEq<GenericShapeCommand<Angle, LengthPercentage>> for GenericShapeCommand<Angle, LengthPercentage>
impl<Angle: PartialEq, LengthPercentage: PartialEq> PartialEq<GenericShapeCommand<Angle, LengthPercentage>> for GenericShapeCommand<Angle, LengthPercentage>
source§fn eq(&self, other: &GenericShapeCommand<Angle, LengthPercentage>) -> bool
fn eq(&self, other: &GenericShapeCommand<Angle, LengthPercentage>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Angle, LengthPercentage> Serialize for GenericShapeCommand<Angle, LengthPercentage>where
Angle: Serialize,
LengthPercentage: Serialize,
impl<Angle, LengthPercentage> Serialize for GenericShapeCommand<Angle, LengthPercentage>where Angle: Serialize, LengthPercentage: Serialize,
source§impl<Angle, LengthPercentage> SpecifiedValueInfo for GenericShapeCommand<Angle, LengthPercentage>where
Angle: SpecifiedValueInfo,
LengthPercentage: SpecifiedValueInfo,
impl<Angle, LengthPercentage> SpecifiedValueInfo for GenericShapeCommand<Angle, LengthPercentage>where Angle: SpecifiedValueInfo, LengthPercentage: SpecifiedValueInfo,
source§const SUPPORTED_TYPES: u8 = _
const SUPPORTED_TYPES: u8 = _
source§impl<Angle, LengthPercentage> ToAnimatedValue for GenericShapeCommand<Angle, LengthPercentage>where
Angle: ToAnimatedValue,
LengthPercentage: ToAnimatedValue,
impl<Angle, LengthPercentage> ToAnimatedValue for GenericShapeCommand<Angle, LengthPercentage>where Angle: ToAnimatedValue, LengthPercentage: ToAnimatedValue,
§type AnimatedValue = GenericShapeCommand<<Angle as ToAnimatedValue>::AnimatedValue, <LengthPercentage as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = GenericShapeCommand<<Angle as ToAnimatedValue>::AnimatedValue, <LengthPercentage as ToAnimatedValue>::AnimatedValue>
source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
source§fn to_animated_value(self) -> Self::AnimatedValue
fn to_animated_value(self) -> Self::AnimatedValue
source§impl<Angle, LengthPercentage> ToAnimatedZero for GenericShapeCommand<Angle, LengthPercentage>where
Angle: ToAnimatedZero,
LengthPercentage: ToAnimatedZero,
impl<Angle, LengthPercentage> ToAnimatedZero for GenericShapeCommand<Angle, LengthPercentage>where Angle: ToAnimatedZero, LengthPercentage: ToAnimatedZero,
source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
source§impl<Angle, LengthPercentage> ToComputedValue for GenericShapeCommand<Angle, LengthPercentage>where
Angle: ToComputedValue,
LengthPercentage: ToComputedValue,
impl<Angle, LengthPercentage> ToComputedValue for GenericShapeCommand<Angle, LengthPercentage>where Angle: ToComputedValue, LengthPercentage: ToComputedValue,
§type ComputedValue = GenericShapeCommand<<Angle as ToComputedValue>::ComputedValue, <LengthPercentage as ToComputedValue>::ComputedValue>
type ComputedValue = GenericShapeCommand<<Angle as ToComputedValue>::ComputedValue, <LengthPercentage as ToComputedValue>::ComputedValue>
source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Context
.