#[repr(C, u8)]pub enum PathCommand {
Unknown,
MoveTo {
point: CoordPair,
absolute: IsAbsolute,
},
LineTo {
point: CoordPair,
absolute: IsAbsolute,
},
HorizontalLineTo {
x: CSSFloat,
absolute: IsAbsolute,
},
VerticalLineTo {
y: CSSFloat,
absolute: IsAbsolute,
},
CurveTo {
control1: CoordPair,
control2: CoordPair,
point: CoordPair,
absolute: IsAbsolute,
},
SmoothCurveTo {
control2: CoordPair,
point: CoordPair,
absolute: IsAbsolute,
},
QuadBezierCurveTo {
control1: CoordPair,
point: CoordPair,
absolute: IsAbsolute,
},
SmoothQuadBezierCurveTo {
point: CoordPair,
absolute: IsAbsolute,
},
EllipticalArc {
rx: CSSFloat,
ry: CSSFloat,
angle: CSSFloat,
large_arc_flag: ArcFlag,
sweep_flag: ArcFlag,
point: CoordPair,
absolute: IsAbsolute,
},
ClosePath,
}
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
Variants§
Unknown
The unknown type. https://www.w3.org/TR/SVG/paths.html#__svg__SVGPathSeg__PATHSEG_UNKNOWN
MoveTo
The “moveto” command.
LineTo
The “lineto” command.
HorizontalLineTo
The horizontal “lineto” command.
VerticalLineTo
The vertical “lineto” command.
CurveTo
The cubic Bézier curve command.
SmoothCurveTo
The smooth curve command.
QuadBezierCurveTo
The quadratic Bézier curve command.
SmoothQuadBezierCurveTo
The smooth quadratic Bézier curve command.
EllipticalArc
Fields
absolute: IsAbsolute
The elliptical arc curve command.
ClosePath
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
Trait Implementations§
source§impl Animate for PathCommand
impl Animate for PathCommand
source§impl Clone for PathCommand
impl Clone for PathCommand
source§fn clone(&self) -> PathCommand
fn clone(&self) -> PathCommand
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ComputeSquaredDistance for PathCommand
impl ComputeSquaredDistance for PathCommand
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
source§impl Debug for PathCommand
impl Debug for PathCommand
source§impl<'de> Deserialize<'de> for PathCommand
impl<'de> Deserialize<'de> for PathCommand
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 MallocSizeOf for PathCommand
impl MallocSizeOf for PathCommand
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq<PathCommand> for PathCommand
impl PartialEq<PathCommand> for PathCommand
source§fn eq(&self, other: &PathCommand) -> bool
fn eq(&self, other: &PathCommand) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for PathCommand
impl Serialize for PathCommand
source§impl SpecifiedValueInfo for PathCommand
impl SpecifiedValueInfo for PathCommand
source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
source§impl ToAnimatedZero for PathCommand
impl ToAnimatedZero for PathCommand
source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
source§impl ToComputedValue for PathCommandwhere
CoordPair: ToComputedValue<ComputedValue = CoordPair>,
IsAbsolute: ToComputedValue<ComputedValue = IsAbsolute>,
CSSFloat: ToComputedValue<ComputedValue = CSSFloat>,
ArcFlag: ToComputedValue<ComputedValue = ArcFlag>,
impl ToComputedValue for PathCommandwhere CoordPair: ToComputedValue<ComputedValue = CoordPair>, IsAbsolute: ToComputedValue<ComputedValue = IsAbsolute>, CSSFloat: ToComputedValue<ComputedValue = CSSFloat>, ArcFlag: ToComputedValue<ComputedValue = ArcFlag>,
§type ComputedValue = PathCommand
type ComputedValue = PathCommand
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
.source§impl ToCss for PathCommand
impl ToCss for PathCommand
source§impl ToResolvedValue for PathCommandwhere
CoordPair: ToResolvedValue<ResolvedValue = CoordPair>,
IsAbsolute: ToResolvedValue<ResolvedValue = IsAbsolute>,
CSSFloat: ToResolvedValue<ResolvedValue = CSSFloat>,
ArcFlag: ToResolvedValue<ResolvedValue = ArcFlag>,
impl ToResolvedValue for PathCommandwhere CoordPair: ToResolvedValue<ResolvedValue = CoordPair>, IsAbsolute: ToResolvedValue<ResolvedValue = IsAbsolute>, CSSFloat: ToResolvedValue<ResolvedValue = CSSFloat>, ArcFlag: ToResolvedValue<ResolvedValue = ArcFlag>,
§type ResolvedValue = PathCommand
type ResolvedValue = PathCommand
source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
source§impl ToShmem for PathCommand
impl ToShmem for PathCommand
impl Copy for PathCommand
impl StructuralPartialEq for PathCommand
Auto Trait Implementations§
impl RefUnwindSafe for PathCommand
impl Send for PathCommand
impl Sync for PathCommand
impl Unpin for PathCommand
impl UnwindSafe for PathCommand
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more