XML/SVG/path — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:25, 26 мая 2010
Содержание
Arc-Based Petal Patterns
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0,0)">
<path d="M150,150 a100,100 0 0,0 100,100 z" fill="red"
stroke="black" stroke-width="4" />
<path d="M150,150 a100,100 0 0,0 -100,100 z" fill="green"
stroke="black" stroke-width="4" />
</g>
</svg>
Coloring Elliptic Arcs
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(20,20)">
<!-- upper-left quadrant -->
<path d="M100,100 A150,50 0 0,1 250,50" fill="black"
stroke="red" stroke-width="8" />
</g>
</svg>
Rendering a Quadratic Bezier Curve
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width="800" height="400">
<g transform="translate(50,50)">
<path d="m20,20 Q100,0 200,200 T340,240 z" fill="black"
stroke-dasharray="2 2 2 2" style="stroke:blue;stroke-width:4;" />
<path d="m0,0 Q100,0 200,200 T300,200 z" fill="red"
stroke-dasharray="2 2 2 2" style="stroke:blue;stroke-width:4;" />
</g>
</svg>
Using path to Render Rectangles
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width="100%" height="100%">
<!-- draw rectangle -->
<g transform="translate(50,50)">
<path d="M0,0 150,0 150,50 0,50" style="fill:red;" />
</g>
</svg>
The uppercase M refers to an absolute point
Use a lowercase m if you need to specify a point in the plane that is relative to the preceding point.