31 lines
No EOL
14 KiB
HTML
31 lines
No EOL
14 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Data structures and traits to work with paths (vector graphics)."><title>cosmic::widget::canvas::path::lyon_path - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../" data-static-root-path="../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../../../../../crates.js"></script><script defer src="../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>widget::<wbr>canvas::<wbr>path</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../index.html">cosmic</a>::<wbr><a href="../../../index.html">widget</a>::<wbr><a href="../../index.html">canvas</a>::<wbr><a href="../index.html">path</a></div><h1>Crate <span>lyon_path</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Data structures and traits to work with paths (vector graphics).</p>
|
|
<p>To build and consume paths, see the <a href="builder/index.html">builder</a> and
|
|
<a href="iterator/index.html">iterator</a> modules.</p>
|
|
<p>This crate is reexported in <a href="https://docs.rs/lyon/">lyon</a>.</p>
|
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>lyon_path::Path;
|
|
<span class="kw">use </span>lyon_path::math::{point};
|
|
<span class="kw">use </span>lyon_path::builder::<span class="kw-2">*</span>;
|
|
|
|
<span class="comment">// Create a builder object to build the path.
|
|
</span><span class="kw">let </span><span class="kw-2">mut </span>builder = Path::builder();
|
|
|
|
<span class="comment">// Build a simple path.
|
|
</span><span class="kw">let </span><span class="kw-2">mut </span>builder = Path::builder();
|
|
builder.begin(point(<span class="number">0.0</span>, <span class="number">0.0</span>));
|
|
builder.line_to(point(<span class="number">1.0</span>, <span class="number">2.0</span>));
|
|
builder.line_to(point(<span class="number">2.0</span>, <span class="number">0.0</span>));
|
|
builder.line_to(point(<span class="number">1.0</span>, <span class="number">1.0</span>));
|
|
builder.close();
|
|
|
|
<span class="comment">// Generate the actual path object.
|
|
</span><span class="kw">let </span>path = builder.build();
|
|
|
|
<span class="kw">for </span>event <span class="kw">in </span><span class="kw-2">&</span>path {
|
|
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, event);
|
|
}</code></pre></div>
|
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="builder/index.html" title="mod cosmic::widget::canvas::path::lyon_path::builder">builder</a></dt><dd>Path building utilities.</dd><dt><a class="mod" href="commands/index.html" title="mod cosmic::widget::canvas::path::lyon_path::commands">commands</a></dt><dd>A generic representation for paths that allow more control over how
|
|
endpoints and control points are stored.</dd><dt><a class="mod" href="geom/index.html" title="mod cosmic::widget::canvas::path::lyon_path::geom">geom</a></dt><dd>Simple 2D geometric primitives on top of euclid.</dd><dt><a class="mod" href="iterator/index.html" title="mod cosmic::widget::canvas::path::lyon_path::iterator">iterator</a></dt><dd>Tools to iterate over paths.</dd><dt><a class="mod" href="math/index.html" title="mod cosmic::widget::canvas::path::lyon_path::math">math</a></dt><dd>f32 version of the lyon_geom types used everywhere. Most other lyon crates
|
|
reexport them.</dd><dt><a class="mod" href="path/index.html" title="mod cosmic::widget::canvas::path::lyon_path::path">path</a></dt><dd>The default path data structure.</dd><dt><a class="mod" href="path_buffer/index.html" title="mod cosmic::widget::canvas::path::lyon_path::path_buffer">path_<wbr>buffer</a></dt><dd>A container to store multiple paths contiguously.</dd><dt><a class="mod" href="polygon/index.html" title="mod cosmic::widget::canvas::path::lyon_path::polygon">polygon</a></dt><dd>Specific path types for polygons.</dd><dt><a class="mod" href="traits/index.html" title="mod cosmic::widget::canvas::path::lyon_path::traits">traits</a></dt><dd><code>lyon_path</code> traits reexported here for convenience.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ArcFlags.html" title="struct cosmic::widget::canvas::path::lyon_path::ArcFlags">ArcFlags</a></dt><dd>Flag parameters for arcs as described by the SVG specification.</dd><dt><a class="struct" href="struct.AttributeSlice.html" title="struct cosmic::widget::canvas::path::lyon_path::AttributeSlice">Attribute<wbr>Slice</a></dt><dd>A view over a contiguous storage of custom attributes.</dd><dt><a class="struct" href="struct.BuilderImpl.html" title="struct cosmic::widget::canvas::path::lyon_path::BuilderImpl">Builder<wbr>Impl</a></dt><dd>The default builder for <code>Path</code>.</dd><dt><a class="struct" href="struct.BuilderWithAttributes.html" title="struct cosmic::widget::canvas::path::lyon_path::BuilderWithAttributes">Builder<wbr>With<wbr>Attributes</a></dt><dd>A builder for <code>Path</code> with custom attributes.</dd><dt><a class="struct" href="struct.ControlPointId.html" title="struct cosmic::widget::canvas::path::lyon_path::ControlPointId">Control<wbr>Point<wbr>Id</a></dt><dd>ID of a control point in a path.</dd><dt><a class="struct" href="struct.EndpointId.html" title="struct cosmic::widget::canvas::path::lyon_path::EndpointId">Endpoint<wbr>Id</a></dt><dd>ID of an endpoint point in a path.</dd><dt><a class="struct" href="struct.EventId.html" title="struct cosmic::widget::canvas::path::lyon_path::EventId">EventId</a></dt><dd>Refers to an event in a path.</dd><dt><a class="struct" href="struct.IdIter.html" title="struct cosmic::widget::canvas::path::lyon_path::IdIter">IdIter</a></dt><dd>An iterator of endpoint and control point ids for <code>Path</code> and <code>PathSlice</code>.</dd><dt><a class="struct" href="struct.IdPolygon.html" title="struct cosmic::widget::canvas::path::lyon_path::IdPolygon">IdPolygon</a></dt><dd>A view over a sequence of endpoint IDs forming a polygon.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::widget::canvas::path::lyon_path::Iter">Iter</a></dt><dd>An iterator for <code>Path</code> and <code>PathSlice</code>.</dd><dt><a class="struct" href="struct.IterWithAttributes.html" title="struct cosmic::widget::canvas::path::lyon_path::IterWithAttributes">Iter<wbr>With<wbr>Attributes</a></dt><dd>An iterator for <code>Path</code> and <code>PathSlice</code>.</dd><dt><a class="struct" href="struct.Path.html" title="struct cosmic::widget::canvas::path::lyon_path::Path">Path</a></dt><dd>A simple path data structure.</dd><dt><a class="struct" href="struct.PathBuffer.html" title="struct cosmic::widget::canvas::path::lyon_path::PathBuffer">Path<wbr>Buffer</a></dt><dd>An object that stores multiple paths contiguously.</dd><dt><a class="struct" href="struct.PathBufferSlice.html" title="struct cosmic::widget::canvas::path::lyon_path::PathBufferSlice">Path<wbr>Buffer<wbr>Slice</a></dt><dd>A view on a <code>PathBuffer</code>.</dd><dt><a class="struct" href="struct.PathCommands.html" title="struct cosmic::widget::canvas::path::lyon_path::PathCommands">Path<wbr>Commands</a></dt><dd>The commands of a path encoded in a single array using IDs to refer
|
|
to endpoints and control points externally.</dd><dt><a class="struct" href="struct.PathCommandsSlice.html" title="struct cosmic::widget::canvas::path::lyon_path::PathCommandsSlice">Path<wbr>Commands<wbr>Slice</a></dt><dd>A view over <a href="struct.PathCommands.html"><code>PathCommands</code></a>.</dd><dt><a class="struct" href="struct.PathSlice.html" title="struct cosmic::widget::canvas::path::lyon_path::PathSlice">Path<wbr>Slice</a></dt><dd>A view on a <code>Path</code>.</dd><dt><a class="struct" href="struct.Polygon.html" title="struct cosmic::widget::canvas::path::lyon_path::Polygon">Polygon</a></dt><dd>A view over a sequence of endpoints forming a polygon.</dd><dt><a class="struct" href="struct.Reversed.html" title="struct cosmic::widget::canvas::path::lyon_path::Reversed">Reversed</a></dt><dd>An iterator of over a <code>Path</code> traversing the path in reverse.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Event.html" title="enum cosmic::widget::canvas::path::lyon_path::Event">Event</a></dt><dd>Represents an event or edge of path.</dd><dt><a class="enum" href="enum.FillRule.html" title="enum cosmic::widget::canvas::path::lyon_path::FillRule">Fill<wbr>Rule</a></dt><dd>The fill rule defines how to determine what is inside and what is outside of the shape.</dd><dt><a class="enum" href="enum.LineCap.html" title="enum cosmic::widget::canvas::path::lyon_path::LineCap">LineCap</a></dt><dd>Line cap as defined by the SVG specification.</dd><dt><a class="enum" href="enum.LineJoin.html" title="enum cosmic::widget::canvas::path::lyon_path::LineJoin">Line<wbr>Join</a></dt><dd>Line join as defined by the SVG specification.</dd><dt><a class="enum" href="enum.Side.html" title="enum cosmic::widget::canvas::path::lyon_path::Side">Side</a></dt><dd>The positive or negative side of a vector or segment.</dd><dt><a class="enum" href="enum.Winding.html" title="enum cosmic::widget::canvas::path::lyon_path::Winding">Winding</a></dt><dd>The two possible orientations for the edges of a shape to be built in.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.NO_ATTRIBUTES.html" title="constant cosmic::widget::canvas::path::lyon_path::NO_ATTRIBUTES">NO_<wbr>ATTRIBUTES</a></dt><dd>An empty attribute slice.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.AttributeStore.html" title="trait cosmic::widget::canvas::path::lyon_path::AttributeStore">Attribute<wbr>Store</a></dt><dd>Interface for objects storing custom attributes associated with endpoints.</dd><dt><a class="trait" href="trait.Position.html" title="trait cosmic::widget::canvas::path::lyon_path::Position">Position</a></dt><dd>Interface for types types (typically endpoints and control points) that have
|
|
a 2D position.</dd><dt><a class="trait" href="trait.PositionStore.html" title="trait cosmic::widget::canvas::path::lyon_path::PositionStore">Position<wbr>Store</a></dt><dd>Interface for objects storing endpoints and control points positions.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.AttributeIndex.html" title="type cosmic::widget::canvas::path::lyon_path::AttributeIndex">Attribute<wbr>Index</a></dt><dd>An alias for <code>usize</code>.</dd><dt><a class="type" href="type.Attributes.html" title="type cosmic::widget::canvas::path::lyon_path::Attributes">Attributes</a></dt><dd>An alias for a slice of <code>f32</code> values.</dd><dt><a class="type" href="type.Builder.html" title="type cosmic::widget::canvas::path::lyon_path::Builder">Builder</a></dt><dt><a class="type" href="type.IdEvent.html" title="type cosmic::widget::canvas::path::lyon_path::IdEvent">IdEvent</a></dt><dd>A path event representing endpoints and control points as IDs.</dd><dt><a class="type" href="type.PathEvent.html" title="type cosmic::widget::canvas::path::lyon_path::PathEvent">Path<wbr>Event</a></dt><dd>A path event representing endpoints and control points as positions.</dd></dl></section></div></main></body></html> |