XML technologies / SVG / Using complex graphic elements and formatting / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
An SVG file with a triangle at 20/20 requires this code:
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg>
<path d="M20 20 h+20 l-10+10 z" style="stroke:black" />
</svg>
Several commands for the
<path>tag can create the arc. One possible solution is:<path d="M50 50 a15 15 0 0 0 +30 0" style="stroke:black;fill:none" />To close the semicircle, add a
horzinstruction at the end of thedattribute:d="M50 50 a15 15 0 0 0 +30 0 z"To fill the semicircle and set transparency to 50%, add the
styleattribute:style="stroke:black;fill:red;opacity:0.5".To group the two elements, use the
<g>tag again.
<g>
<path d="M20 20 h+20 l-10+10 z" style="stroke:black" />
<path d="M50 50 a15 15 0 0 0 +30 0 z" style="stroke:black;fill:red;opacity:0.5" />
</g>
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top