Skip to content

Commit 3002754

Browse files
committed
Add a draw() shape syntax, which accepts shape-segments equivalent to
SVG path segments. Fixes #5674
1 parent b16425c commit 3002754

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

css-shapes-2/Overview.bs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ spec:css-masking-1; type: value
1818
text: nonzero
1919
text: evenodd
2020
spec:css-shapes-1; type:property; text:shape-margin
21+
spec:css-shapes-2; type:type; text:<uri>
2122
</pre>
2223

2324
<style type="text/css">
@@ -139,6 +140,19 @@ Supported Shapes</h3>
139140
section, with the following integrated.
140141

141142
<dl>
143+
<dt>
144+
<pre class=prod>
145+
<dfn>draw()</dfn> = draw( [<<fill-rule>>,]? from <<coordinate-pair>>, <<draw-command>>#])
146+
</pre>
147+
</dt>
148+
<dd dfn-type=value dfn-for="draw()">
149+
<ul>
150+
<li>
151+
The <<coordinate-pair>> represents the initial point of the path.
152+
<li>
153+
The sequence of <dfn><<draw-command>></dfn>s represent commands of an
154+
<a href="https://www.w3.org/TR/SVG11/paths.html#PathData">SVG Path</a>.
155+
</ul>
142156
<dt>
143157
<pre class=prod>
144158
<dfn>path()</dfn> = path( [<<fill-rule>>,]? <<string>> )
@@ -166,6 +180,60 @@ Supported Shapes</h3>
166180
For the initial direction follow SVG 1.1.
167181
</ul>
168182
</dl>
183+
184+
The arguments not defined above are defined as follows:
185+
186+
<dl>
187+
<dt><dfn><<coordinate-pair>></dfn> = <<length-percentage>>{2}
188+
<dd>Defines a pair of coordinates x & y.
189+
<dt><dfn><<draw-command>></dfn> = <<move-command>> | <<line-command>> | <<perpendicular-line-command>> |
190+
<<curve-command>> | <<smooth-command>> | <<arc-command>> | close
191+
<dd>
192+
Defines a single draw command, equivalent to an <a href="https://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation">SVG draw command</a>.
193+
<dt><dfn><<by-to>></dfn> = by | to
194+
<dd>
195+
Represents the reference from which offsets are computed in <<draw-command>>s.
196+
When ''to'' is present, the coordinates are relative to the top-left origin of the reference box.
197+
Otherwise ''by'' is present, the coordinates are relative to the end position of the previous command.
198+
199+
Note:
200+
<<percentage>> values are always computed relative to the reference box regardless of how offsets are computed.
201+
<dd>
202+
203+
<dt><dfn><<move-command>></dfn> = move <<by-to>> <<coordinate-pair>>
204+
<dd>
205+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands">moveto</a> command.
206+
<dt><dfn><<line-command>></dfn> = line <<by-to>> <<coordinate-pair>>
207+
<dd>
208+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands">lineto</a> command.
209+
<dt><dfn><<perpendicular-line-command>></dfn> = [horizontal|vertical] <<by-to>> <<length-percentage>>
210+
<dd>
211+
Corresponds to a horizontal or vertical <a href="https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands">lineo</a> command.
212+
<dt><dfn><<curve-command>></dfn> = curve <<by-to>> <<coordinate-pair>> via <<coordinate-pair>>{1,2}
213+
<dd>
214+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands">quadratic curve</a> command if one <<coordinate-pair>> is provided,
215+
otherwise corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands">cubic curve</a> command.
216+
<dt><dfn><<smooth-command>></dfn> = smooth <<by-to>> <<coordinate-pair>> [via <<coordinate-pair>>]?
217+
<dd>
218+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands">smooth cubic curve</a> command if a <<coordinate-pair>> is provided,
219+
otherwise corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands">smooth quadratic curve</a> command.
220+
<dt><dfn><<arc-command>></dfn> = arc <<by-to>> <<coordinate-pair>> [[radius <<length-percentage>>{1,2}] && <<arc-large>> && <<arc-sweep>> && <<angle>>?]
221+
<dd>
222+
Corresponds to an <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">arc</a> command, with a given radius, x-axis rotation <<angle>>, ''large'' and ''sweep'' flags.
223+
<dt><dfn><<arc-large>></dfn> = [large | small]?
224+
<dd>
225+
If ''small'' is set, the arc's <a href="">large</a> flag is set to 0.
226+
If ''large'' is set, the arc's <a href="">large</a> flag is set to 1.
227+
If it is not set, the automatic value is used.
228+
<dt><dfn><<arc-sweep>></dfn> = [cw | ccw]?
229+
<dd>
230+
If ''ccw'' is set, the arc's <a href="">sweep</a> flag is set to 0.
231+
If ''cw'' is set, the arc's <a href="">sweep</a> flag is set to 1.
232+
If it is not set, the automatic value is used.
233+
<dt>close
234+
<dd>
235+
Corrsepponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand">closepath</a> command.
236+
</dl>
169237

170238
<div class="issue-marker wrapper">
171239
<div class="issue-marker" data-bug_id="16448" data-bug_status="ASSIGNED">

0 commit comments

Comments
 (0)