Hello World (SVG)

From LiteratePrograms

Jump to: navigation, search
Other implementations: Ada | ALGOL 68 | Alice ML | Amiga E | Applescript | AspectJ | Assembly Intel x86 Linux | Assembly Intel x86 NetBSD | AWK | bash | BASIC | Batch files | C | C, Cairo | C, Xlib | Candle | Clojure | C++ | C# | Delphi | Dylan | E | Eiffel | Erlang | Forth | FORTRAN | Fortress | Go | Groovy | Haskell | Hume | IBM PC bootstrap | Inform 7 | Java | Java, Swing | JavaScript | LaTeX | Lisp | Logo | Lua | Maple | MATLAB | Mercury | OCaml/F Sharp | occam | Oz | Pascal | Perl | PHP | Pic | PIR | PLI | PostScript | Prolog | Python | Rexx | Ruby | Scala | Scheme | Seed7 | sh | Smalltalk | SQL | Standard ML | SVG | Tcl | Tcl Tk | Visual Basic | Visual Basic .NET | XSL

Scalable Vector Graphics (SVG) is an XML markup language for describing two-dimensional vector graphics. This is a simple SVG document that draws a box with a string.

<<HelloWorld.svg>>=
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/TR/SVG/DTD/svg11.dtd">
<svg width="220px" height="120px"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xml:space="preserve"
     version="1.1">
  <desc>"Hello, World!" example for SVG</desc>
  <g id="box">
    <rect x = "10" y = "10" rx = "20" ry = "10" width = "200" height = "80"
          fill = "#d7d0b9" stroke = "#333" stroke-width = "1"/>
    <text font-size="25">
      <tspan x="35" y="55">Hello, World!</tspan>
    </text>
  </g>
</svg>
Example SVG document

The result is shown in the figure.

External links

  • SVG to raster image conversion (Online)
  • Scalable Vector Graphics (SVG)
Download code
Views