Logo

2D Web Graphics: SVG

I. Herman, W3C, Head of Offices
Tampere, October 11, 2002

  1. Title Page
  2. Graphics on the Web today
  3. What do we need?
  4. SVG
  5. A simple SVG example
  6. The “basics” are all there...
  7. Duck examples
  8. “Unusual” features
  9. Filters
  10. Filter operations
  11. Filter details
  12. Filter examples
  13. Filter example: picture compositing
  14. SVG animation
  15. SVG animation example
  16. What is animated?
  17. Walking man...
  18. How is animation performed?
  19. Bouncing cubes
  20. When is animation performed?
  21. Chaining animations
  22. Lights and images: animating filters
  23. SVG DOM
  24. Interaction with the DOM tree
  25. When should scripts be used?
  26. Clock
  27. Mine sweeper example
  28. SVG and (X)HTML
  29. Better (future) integration
  30. Implementations: players
  31. Implementations: authoring
  32. Application examples
  33. Roadmap of SVG Evolution
  34. SVG Basic & Tiny
  35. First mobile SVG implementations
  36. Further information
  37. Further information (cont)
Logo

2D Web Graphics: SVG

I. Herman, W3C, Head of Offices

Opening Event of the W3C Finnish Office

Tampere, October 11, 2002

http://www.w3.org/2002/Talks/SVG-Tampere-IH/

Logo

Graphics on the Web today

  • Pixel based images (gif, png, jpeg, ...)
    • Fixed resolution
    • Can be very large
    • Original “information” is lost
      • difficult to add metadata
      • difficult to adapt to viewing environment
    • Limited interaction (except for animated gifs and the like)
    • Client/server side image maps for linking
      • clumsy, requires separate authoring tools
  • Other, proprietary solutions
    • proprietary authoring tools, players, ...

I. Herman, W3C, Head of OfficesTampere, October 11, 20021 (36)
Logo

What do we need?

Vector graphics
Resolution independent
Keeps "content" information
In line with earlier developments (GKS, PHIGS, PostScript, ...)
Textual encoding (too)
Let the client side interpret the content
Searchable
Easy to edit, add links, etc
Based on XML
Use a well-understood syntax
Can “inherit” functionalities from elsewhere
Can make use of XML aware software (implementations, editing, ...)
Integrates well with the rest of the Web

I. Herman, W3C, Head of OfficesTampere, October 11, 20022 (36)
Logo

SVG

Scalable Vector Graphics (SVG):

  • W3C Working Group was created in 1998
  • Specification quite stable by 2000, with first implementations
  • Version 1.0 became a W3C recommendation in September 2001
  • Work is continuing:
    • Mobile Profiles (part of the 3GPP protocols)
    • Richer functionalities: Version 2.0
“SVG is the HTML for Graphics”

I. Herman, W3C, Head of OfficesTampere, October 11, 20023 (36)
Logo

A simple SVG example

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 20024 (36)
Logo

The “basics” are all there...

  • Paths can be closed or open
  • Paths can be filled with colour, gradients, patterns, ...
  • Attributes can control line style, dash, joining, miter, ...
  • Shortcuts for rectangles, arcs, circles, splines, ...
  • Images can be included
  • Clipping, masking
  • Separate text element with tons of attributes
  • Everything can be transformed (rotated, skewed, translated, etc)
  • All the usual operations of 2D graphics are available

I. Herman, W3C, Head of OfficesTampere, October 11, 20025 (36)
Logo

Duck examples

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 20026 (36)
Logo

“Unusual” features

SVG has also some more “unusual” features:

  • Filter operations
  • Animations
  • Scripting

I. Herman, W3C, Head of OfficesTampere, October 11, 20027 (36)
Logo

Filters

  • Graphics on the Web is often used for "artwork"
    • complex logos
    • "sexy" presentations (shadow effects, pseudo 3D)
    • advertisements
  • Filters have been added to SVG to produce such artworks
image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 20028 (36)
Logo

Filter operations

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 20029 (36)
Logo

Filter details

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200210 (36)
Logo

Filter examples

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200211 (36)
Logo

Filter example: picture compositing

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200212 (36)
Logo

SVG animation

  • SVG Animation = change object attributes dynamically
  • Animation is controlled through a set of animation objects
    • reusing parts of W3C's SMIL2.0 Specification

      (Synchronized Multimedia Integration Language Version 2.0)

  • Declarative syntax, no real increase in file size
  • Animation is performed on client side

I. Herman, W3C, Head of OfficesTampere, October 11, 200213 (36)
Logo

SVG animation example

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200214 (36)
Logo

What is animated?

  • Practically all attributes can be changed
  • Separate animation elements
    • animate, animateMotion, animateTransform
    • animateColor
    • set (changes discrete values)
  • Example:
image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200215 (36)
Logo

Walking man...

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200216 (36)
Logo

How is animation performed?

  • By default, animation is linear
    • the [from,to] interval is interpolated linearly over required duration
  • Alternative possibilities:
    • Discrete jumps (no interpolation)
    • Specify intermediate (key) values and time
    • Replace linear interpolation by (cubic) splines (in [0,1])
    • Key times and spline interpolation can be combined

I. Herman, W3C, Head of OfficesTampere, October 11, 200217 (36)
Logo

Bouncing cubes

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200218 (36)
Logo

When is animation performed?

  • Simple case: time-based animation
    • begin, dur, end attributes
    • values are in time (with "t = 0" value at loading)
    • all kinds of time units are available
  • Complicated case: event-based animation
    • begin attribute can refer to events, eg:
      • obj.click, when a click occurs on obj
      • anim.end or anim.begin, when anim ends, resp. begins
      • anim.end; anim2.end, when anim or anim2 ends
      • anim.begin+4s 4 seconds afteranim begins
      • obj.mouseover, obj.mouseout when mouse moves over/out obj
      • ...

I. Herman, W3C, Head of OfficesTampere, October 11, 200219 (36)
Logo

Chaining animations

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200220 (36)
Logo

Lights and images: animating filters

Put a light source "above" the image and animate its characteristics...

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200221 (36)
Logo

SVG DOM

  • DOM = Document Object Model
    • programmatic interface to the runtime XML tree
    • a general W3C mechanism with an SVG specialization
  • Scripts can be included in SVG (through a script node)
  • Scripts can modify:
    • the XML tree (add and/or delete nodes)
    • the attributes of individual objects

I. Herman, W3C, Head of OfficesTampere, October 11, 200222 (36)
Logo

Interaction with the DOM tree

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200223 (36)
Logo

When should scripts be used?

  • Complex animation and/or interaction
    • complicated visual effects
    • need for the state of interaction
    • more compact code
    • list handling
  • Numerical calculations
  • Client/server type applications
  • Random features (eg, random choice among alternatives)

I. Herman, W3C, Head of OfficesTampere, October 11, 200224 (36)
Logo

Clock

    <g onload="Start(evt)" ... >
    ...
    function Start(evt)
        var now=new Date();
        clockObj.adjustTime(now);
    }
image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200225 (36)
Logo

Mine sweeper example

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200226 (36)
Logo

SVG and (X)HTML

Inclusion into HTML with a plugin:

    <object data="File.svg" width=".." height=".." type="image/svg+xml">
        <img src="..." alt="Image replacement...>
    </object>
  • embed also works, but is deprecated in HTML4 and XHTML
  • all kinds of units (mm, cm, inch, etc) can also be used

I. Herman, W3C, Head of OfficesTampere, October 11, 200227 (36)
Logo

Better (future) integration

  • Inclusion into any XML with namespaces (eg, XHTML)
    <?xml version="1.0" standalone="yes"?>
    <parent xmlns="http://example.org"
            xmlns:gr="http://www.w3.org/2000/svg">
      <parentElement>....</parentElement>
      <anotherParentElement>
        <gr:svg viewBox="..." width="..." height="..." ... >
          <gr:rect>....</gr:rect>
        </gr:svg>
      </anotherParentElement>
    </parent>
  • Works in W3C's Amaya, X-Smiles, and Mozilla's SVG build
    • none of these is a complete implementation of SVG...
  • Allows for a nice combination of XML applications!

I. Herman, W3C, Head of OfficesTampere, October 11, 200228 (36)
Logo

Implementations: players

  • Adobe's plugin, works with major browsers on Win and Mac;

    Linux and Solaris in beta

  • kSVG project for Konqueror on Linux
  • Various standalone players, mostly in Java (eg, Batik)
  • Ongoing Mozilla project
  • Implementations for Palm PC-s, phones, embedded systems
    • they implement the mobile profiles (see later)
  • Canon is experimenting with an SVG Printer
None of these are complete, but we are getting there!

I. Herman, W3C, Head of OfficesTampere, October 11, 200229 (36)
Logo

Implementations: authoring

  • Export facilities from Adobe AI, Corel, OpenOffice.org, ...
  • "Pure" SVG drawing tool from Jasc, PCX, ...
  • Conversion tools
    • Square1's PS to SVG
    • SVG Factory's WMF or BMP to SVG
    • KK Software or Celiena's raster to SVG
    • Software Mechanics' SVGMaker
  • Subclass to Java's Graphics2D to generate SVG (part of Batik)
  • Direct SVG DOM implementation in Java (also part of Batik)

Check W3C's site: http://www.w3.org/Graphics/SVG/!

I. Herman, W3C, Head of OfficesTampere, October 11, 200230 (36)
Logo

Application examples

I. Herman, W3C, Head of OfficesTampere, October 11, 200231 (36)
Logo

Roadmap of SVG Evolution

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200232 (36)
Logo

SVG Basic & Tiny

  • SVG Basic:
    • All numbers must be limited to a 16bits range
    • No elliptical arcs in paths
    • Subsets of filters (e.g., no lighting)
    • Scripting facility is optional
    • etc
  • SVG Tiny:
    • All the SVG Basic profile restrictions
    • No clipping, no opacity, no filters
    • No text on path
    • etc
  • Candidate recommendation published since 30th of April 2002

I. Herman, W3C, Head of OfficesTampere, October 11, 200233 (36)
Logo

First mobile SVG implementations

image replacement for an SVG file...

I. Herman, W3C, Head of OfficesTampere, October 11, 200234 (36)
Logo

Further information

The SVG Recommendation itself:
http://www.w3.org/TR/SVG/
Textbooks
There are about six books published already (!)
Some other sites on SVG:
http://www.kevlindev.com (Kevin Lindsey)
http://pilat.free.fr/filters/ (Michel Hirtzler)
http://groups.yahoo.com/group/svg-developers/
....
Proceedings of SVG Open 2002
http://www.svgopen.org/index-2002.shtml
Start by:
http://wdvl.com/Authoring/Languages/XML/SVG/
http://www.w3.org/Graphics/SVG/

I. Herman, W3C, Head of OfficesTampere, October 11, 200235 (36)
Logo

Further information (cont)

I. Herman, W3C, Head of OfficesTampere, October 11, 200236 (36)