Type Alias style::values::specified::svg_path::PathCommand

source ·
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.

Fields

§by_to: ByTo
§

Line

The line command.

Fields

§by_to: ByTo
§

HLine

The hline command.

Fields

§by_to: ByTo
§

VLine

The vline command.

Fields

§by_to: ByTo
§

CubicCurve

The cubic Bézier curve command.

Fields

§by_to: ByTo
§

QuadCurve

The quadratic Bézier curve command.

Fields

§by_to: ByTo
§

SmoothCubic

The smooth command.

Fields

§by_to: ByTo
§

SmoothQuad

The smooth quadratic Bézier curve command.

Fields

§by_to: ByTo
§

Arc

The arc command.

Fields

§by_to: ByTo
§arc_sweep: ArcSweep
§arc_size: ArcSize
§rotate: f32
§

Close

The closepath command.

Implementations§

source§

impl PathCommand

source

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

source

fn to_css_for_svg<W>(&self, dest: &mut CssWriter<'_, W>) -> Result
where W: Write,

The serialization of the svg path.