Skip to content

Commit e8404d1

Browse files
authored
[css-shapes-2] Add a shape() syntax, which accepts shape-segments equivalent to SVG path (#5711)
1 parent f68bcc7 commit e8404d1

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

css-shapes-2/Overview.bs

+76
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ 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>
22+
spec:css-writing-modes-4; type:concept; text:physical
23+
spec:css-writing-modes-4; type:concept; text:"writing mode"
2124
</pre>
2225

2326
<style type="text/css">
@@ -165,6 +168,79 @@ Supported Shapes</h3>
165168
in the path string.
166169
For the initial direction follow SVG 1.1.
167170
</ul>
171+
<dt>
172+
<pre class=prod>
173+
<dfn>shape()</dfn> = shape( [<<fill-rule>>]? from <<coordinate-pair>>, <<draw-command>>#)
174+
</pre>
175+
<dd dfn-type=value dfn-for="shape()">
176+
<ul>
177+
<li>
178+
The <<coordinate-pair>> represents the starting point for the first draw-command,
179+
in physical coordinates.
180+
<li>
181+
The sequence of <dfn><<draw-command>></dfn>s represent commands of an
182+
<a href="https://www.w3.org/TR/SVG11/paths.html#PathData">SVG Path</a>.
183+
</ul>
184+
</dl>
185+
186+
The arguments not defined above are defined as follows:
187+
188+
<dl>
189+
<dt><dfn><<coordinate-pair>></dfn> = <<length-percentage>>{2}
190+
<dd>Defines a pair of coordinates x & y.
191+
192+
<dt><dfn><<draw-command>></dfn> = <<move-command>> | <<line-command>> | <<hv-line-command>> |
193+
<<curve-command>> | <<smooth-command>> | <<arc-command>> | close
194+
<dd>
195+
Defines a single draw command, equivalent to an <a href="https://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation">SVG draw command</a>.
196+
<dt><dfn><<by-to>></dfn> = by | to
197+
<dd>
198+
Represents the reference from which offsets are computed in <<draw-command>>s.
199+
When ''to'' is present, the coordinates are relative to the top-left origin of the reference box.
200+
Otherwise ''by'' is present, the coordinates are relative to the end position of the previous command.
201+
202+
Note:
203+
<<percentage>> values are always computed relative to the reference box regardless of how offsets are computed.
204+
<dd>
205+
206+
<dt><dfn><<move-command>></dfn> = move <<by-to>> <<coordinate-pair>>
207+
<dd>
208+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands">moveto</a> command.
209+
<dt><dfn><<line-command>></dfn> = line <<by-to>> <<coordinate-pair>>
210+
<dd>
211+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands">lineto</a> command.
212+
If '''x''' or '''y''' are present instead of a <<length-percentage>>, the line will be horizontal or vertical, respectively.
213+
<dt><dfn><<hv-line-command>></dfn> = [hline | vline] <<by-to>> <<length-percentage>>
214+
<dd>
215+
Corresponds to a horizontal or vertical <a href="https://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands">lineto</a> command.
216+
<dt><dfn><<curve-command>></dfn> = curve <<by-to>> <<coordinate-pair>> via <<coordinate-pair>>{1,2}
217+
<dd>
218+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands">quadratic curve</a> command if one <<coordinate-pair>> is provided,
219+
otherwise corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands">cubic curve</a> command.
220+
<dt><dfn><<smooth-command>></dfn> = smooth <<by-to>> <<coordinate-pair>> [via <<coordinate-pair>>]?
221+
<dd>
222+
Corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands">smooth cubic curve</a> command if a second <<coordinate-pair>> is provided,
223+
otherwise corresponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands">smooth quadratic curve</a> command.
224+
<dt><dfn><<arc-command>></dfn> = arc [<<by-to>> <<coordinate-pair>> <<arc-radius>> || <<arc-sweep>> || <<arc-large>> || <<angle>>]
225+
<dd>
226+
Corresponds to an <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">arc</a> command.
227+
<dt><dfn><<arc-radius>></dfn> = of <<length-percentage>>{1, 2}
228+
<dd>
229+
Corresponds to the arc's <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">radius</a>.
230+
If only one <<length-percentage>> is present, that value will be used for both '''rx''' and '''ry'''.
231+
<dt><dfn><<arc-sweep>></dfn> = [cw | ccw]?
232+
<dd>
233+
If ''ccw'' is set, the arc's <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">sweep</a> flag is set to 0.
234+
If ''cw'' is set, the arc's <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">sweep</a> flag is set to 1.
235+
If it is not set, the automatic value is used.
236+
<dt><dfn><<arc-large>></dfn> = [large | small]?
237+
<dd>
238+
If ''large'' is set, the arc's <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">large</a> flag is set to 1.
239+
If ''small'' is set, the arc's <a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands">large</a> flag is set to 0.
240+
If it is not set, the automatic value is used.
241+
<dt>close
242+
<dd>
243+
Corrsepponds to a <a href="https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand">closepath</a> command.
168244
</dl>
169245

170246
<div class="issue-marker wrapper">

0 commit comments

Comments
 (0)