1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
---
title: fill-rule
slug: Web/SVG/Attribute/fill-rule
translation_of: Web/SVG/Attribute/fill-rule
---
<div>{{SVGRef}}</div>
<p>The <strong><code>fill-rule</code></strong> этот атрибут представления, формулирует алгоритм, используемый для определения внутренней части фигуры.</p>
<p class="note"><strong>Note:</strong> Атрибут представления, <code>fill-rule</code> может быть использован как CSS свойство.</p>
<p>Как атрибут представления, он может быть применён к следующим восьми элементам:: {{SVGElement('altGlyph')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tref')}}, and {{SVGElement('tspan')}}</p>
<div id="topExample">
<div class="hidden">
<pre class="brush: css">html,body,svg { height:100% }</pre>
</div>
<pre class="brush: html"><svg viewBox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg">
<!-- Default value for fill-rule -->
<polygon fill-rule="nonzero" stroke="red"
points="50,0 21,90 98,35 2,35 79,90"/>
<!--
The center of the shape has two
path segments (shown by the red stroke)
between it and infinity. It is therefore
considered outside the shape, and not filled.
-->
<polygon fill-rule="evenodd" stroke="red"
points="150,0 121,90 198,35 102,35 179,90"/>
</svg></pre>
<p>{{EmbedLiveSample('topExample', '100%', 200)}}</p>
</div>
<h2 id="Примечания_по_использованию">Примечания по использованию</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">Значение</th>
<td><code>nonzero</code> | <code>evenodd</code></td>
</tr>
<tr>
<th scope="row">Значение по умолчанию</th>
<td><code>nonzero</code></td>
</tr>
<tr>
<th scope="row">Анимируемый</th>
<td>Да</td>
</tr>
</tbody>
</table>
<p>The <code>fill-rule</code> attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined:</p>
<h3 id="nonzero">nonzero</h3>
<p>The value <code>nonzero</code> determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.</p>
<h4 id="Example">Example</h4>
<div class="hidden">
<pre class="brush: css">html,body,svg { height:100% }</pre>
</div>
<pre class="brush: html"><svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
<!-- Effect of nonzero fill rule on crossing path segments -->
<polygon fill-rule="nonzero" stroke="red"
points="50,0 21,90 98,35 2,35 79,90"/>
<!--
Effect of nonzero fill rule on a shape inside a shape
with the path segment moving in the same direction
(both squares drawn clockwise, to the "right")
-->
<path fill-rule="nonzero" stroke="red"
d="M110,0 h90 v90 h-90 z
M130,20 h50 v50 h-50 z"/>
<!--
Effect of nonzero fill rule on a shape inside a shape
with the path segment moving in the opposite direction
(one square drawn clockwise, the other anti-clockwise)
-->
<path fill-rule="nonzero" stroke="red"
d="M210,0 h90 v90 h-90 z
M230,20 v50 h50 v-50 z"/>
</svg></pre>
<p>{{EmbedLiveSample('nonzero', '100%', 200)}}</p>
<h3 id="evenodd">evenodd</h3>
<p>The value <code>evenodd</code> determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.</p>
<h4 id="Example_2">Example</h4>
<div class="hidden">
<pre class="brush: css">html,body,svg { height:100% }</pre>
</div>
<pre class="brush: html"><svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
<!-- Effect of evenodd fill rule on crossing path segments -->
<polygon fill-rule="evenodd" stroke="red"
points="50,0 21,90 98,35 2,35 79,90"/>
<!--
Effect of evenodd fill rule on on a shape inside a shape
with the path segment moving in the same direction
(both squares drawn clockwise, to the "right")
-->
<path fill-rule="evenodd" stroke="red"
d="M110,0 h90 v90 h-90 z
M130,20 h50 v50 h-50 z"/>
<!--
Effect of evenodd fill rule on a shape inside a shape
with the path segment moving in opposite direction
(one square drawn clockwise, the other anti-clockwise)
-->
<path fill-rule="evenodd" stroke="red"
d="M210,0 h90 v90 h-90 z
M230,20 v50 h50 v-50 z"/>
</svg></pre>
<p>{{EmbedLiveSample('evenodd', '100%', 200)}}</p>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<p>{{Compat("svg.attributes.presentation.fill-rule")}}</p>
<h2 id="Specification">Specification</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName("SVG2", "painting.html#FillRuleProperty", "fill-rule")}}</td>
<td>{{Spec2("SVG2")}}</td>
<td>Definition for shapes and text</td>
</tr>
<tr>
<td>{{SpecName("SVG1.1", "painting.html#FillRuleProperty", "fill-rule")}}</td>
<td>{{Spec2("SVG1.1")}}</td>
<td>Initial definition for shapes and text</td>
</tr>
</tbody>
</table>
<div class="ddict_div" style="top: 1201.2px; max-width: 120px; left: 303.181px;"><img class="ddict_audio">
<p class="ddict_sentence">да</p>
</div>
|