SVG i dagens nettlesermarked

Petter Dahl Thunæs / Robin Smidsrød

Høgskolen i Vestfold / Vestfold University College

Problemstilling

Modellapplikasjon:

Arbeidsmetodikk

Modellapplikasjon

Prosessverktøy

Hva er SVG?

Ulike SVG-profiler, ulike formål

Medlemmer i SVG Working Group

Adobe Systems Inc., Apple, Inc., Canon, Inc., Cisco, ERICSSON, Ikivo AB, INSTITUT TELECOM, Microsoft Corporation, Mozilla Foundation, Opera Software, PTC-Arbortext, Quickoffice Inc, Rochester Institute of Technology, Samsung Electronics Co., Ltd., Telecom Italia SpA

Aktivitet på offentlige epostlister:

Historisk bakgrunn

Utgivelser av SVG-standarden

Hvordan ser SVG ut?

Linje

line example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 350 350">
 <line x1="0" y1="0" x2="300" y2="300"
  style="stroke: rgb(99,99,99); stroke-width: 2;"
 />
</svg>

Sammenhengende linjer

polyline example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 1200 1200">
 <polyline
  fill="none"
  stroke="blue"
  stroke-width="10"
  points="  50,375
            150,375 150,325 250,325 250,375
            350,375 350,250 450,250 450,375
            550,375 550,175 650,175 650,375
            750,375 750,100 850,100 850,375
            950,375 950,25 1050,25 1050,375
            1150,375"
 />
</svg>

Polygon

polygon example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 350 350">
 <polygon points="220,100 300,210 170,250 123,234"
  style="fill: #cccccc; stroke: #000000; stroke-width: 1;"
 />
</svg>

Rektangel

rect example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 300 300">
 <rect x="20" y="20" rx="10" ry="5" width="250" height="100"
  style="fill: red; stroke: black; stroke-width: 5; opacity: 0.5;"
 />
</svg>

Sti

path example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 400 400">
 <path d="M153 334
C153 334 151 334 151 334
C151 339 153 344 156 344
C164 344 171 339 171 334
C171 322 164 314 156 314
C142 314 131 322 131 334
C131 350 142 364 156 364
C175 364 191 350 191 334
C191 311 175 294 156 294
C131 294 111 311 111 334
C111 361 131 384 156 384
C186 384 211 361 211 334
C211 300 186 274 156 274"
  style="fill: white; stroke: red; stroke-width: 2;"
 />
</svg>

Sirkel

circle example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 200 200">
 <circle cx="50%" cy="50%"
         r="50"
         stroke="black" stroke-width="2"
         fill="red" />
</svg>

Ellipse

ellipse example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 200 200">
 <ellipse cx="50%" cy="50%" rx="50%" ry="25%"
  style="fill: rgb(200,100,50); stroke: rgb(0,0,100); stroke-width: 2;"
 />
</svg>

Tekst

text example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 300 300">
 <text x="10" y="20" style="font-family:sans-serif;font-size:24"
  >Stationary text</text>
 <text x="10" y="40" style="font-family:serif;font-size:24">Moving text
  <animateMotion path="M 10 40 L 200 40" dur="0.5s" fill="freeze" />
 </text>
</svg>

Filter

filter example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
             xmlns:xlink="http://www.w3.org/1999/xlink"
     viewBox="0 0 300 300">
 <defs>
  <filter id="shadow">
   <feGaussianBlur in="SourceGraphic" stdDeviation="2" result="blur" />
   <feOffset in="blur" dx="3" dy="3" />
  </filter>
  <text id="text"
   x="10%" y="10%"
   font-family="sans-serif" font-size="150%"
   >Text with drop shadow
  </text>
 </defs>
 <use xlink:href="#text" filter="url(#shadow)" stroke="grey" />
 <use xlink:href="#text" stroke="black" />
</svg>

Animasjon

animation example

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 300 300">
 <rect
  x="20" y="20"
  rx="0" ry="0"
  width="250" height="100"
  fill="red"
  stroke="black" stroke-width="5">
  <animateColor attributeName="fill" attributeType="XML"
   from="red" to="yellow"
   dur="2s"
   fill="freeze"
  />
  <animate attributeName="rx" attributeType="XML"
   from="0" to="10"
   begin="2s" dur="2s"
   fill="freeze"
  />
  <animate attributeName="ry" attributeType="XML"
   from="0" to="10"
   begin="2s" dur="2s"
   fill="freeze"
  />
 </rect>
</svg>

Programvare med SVG-støtte

Programvare som kan produsere SVG-dokumenter

Kommersiell programvare

Fri programvare

Verktøy for utviklere

Nettlesere og SVG-støtte

Dekningsgrad i implementasjonene

Ikke støttet funksjonalitet

Modul Firefox Opera WebKit
Filter OK OK DELVIS
Font FEIL OK OK
Animation FEIL OK DELVIS
Text DELVIS OK OK

Funksjonalitet med feil

Ingen SVG-støtte i IE

Microsoft melder seg inn i SVG WG

Microsoft IE9 vil støtte SVG

IE9 Preview SVG support:

Alternativer til SVG

Adobe Flash

Fordeler med Flash

Ulemper med Flash

Microsoft Silverlight

Fordeler med Silverlight

Ulemper med Silverlight

Raphaël

Fordeler med Raphaël

Ulemper med Raphaël

Microsoft VML

Fordeler med VML

Ulemper med VML

Konklusjon

Modellapplikasjonen

Sektordiagram

sector chart

Stolpediagram

bar chart

Linjediagram

line chart

Sirkeldiagram

scatter chart

Brukergrensesnitt

SVGChartApp

SVG-generatorbibliotek

SVGChartLibrary UML Class Diagram

Utviklingsprosess

Spørsmål?