Transcript Scalable Vector Graphics Zvi Topol and Yossi Cohn
Scalable Vector Graphics
Zvi Topol and Yossi Cohn
Outline
Introduction Vector Graphics vs Bitmap Graphics Graphic formats and motivation for SVG.
Data types and structural elements.
Text and Basic Shapes Transformations and Paths Animation Other SVG Features Demos 2
Introduction
Graphics on the Web has many different uses: The WWW contains milliards of pages of data.
Graphics is an important tool to visualize that data (diagrams, illustrations, images, etc) Graphics is also a good means to convey messages: art, advertisements, campaigns It also can be used to create virtual environments and worlds - virtual shops, games, simulators. 3
Introduction(cont ’d)
There are two main ways to represent graphics on the Web: Bitmapped Graphics - storing the RGB values of each pixel in the image.
Vector Graphics - storing the coordinates of each vectors and the colors in which they are rendered.
4
Bitmapped Graphics
Bitmapped images are widely used over the Internet: attached to HTML documents using tag. Main formats: GIF, JPEG, BMP.
Represented in Binary format.
Image processing is done on server side and image is transferred as is to client.
5
Vector Graphics
Uses of the power of transformations, coordinate systems, units and vector-based shapes.
Rendering is done on the client side - using local processing power.
Can be represented in both binary and text formats.
Can include Bitmap images 6
Vectors vs Bitmaps(1)
Size : Vectors cost much less to represent than bitmaps. Example: a diagonal blue line on 640X480 window costs ~3000 bytes with a Bitmap. Same line using Vector Graphics ~20 bytes.
Bitmaps have problems with resolution and colors when viewed and printed on different kinds of screens and printers at different sizes. Transformations can be applied on vectors to solve this problem.
7
Vectors vs Bitmaps(2)
Format representation - Bitmaps are binary files, vector based graphics can be represented as text files. Drawing instruction include text, and so are selectable and searchable. Links can be created to any part of a vector based image.
Flexibility - Vectors are much more flexibly to changes (transformations and different text styles).
8
Vectors vs Bitmaps(3)
Animation is much simpler using vectors.
Accessibility to editing - easier to edit quickly a textual file than a binary file.
Interactivity – the ease of using scripts allows very good interactivity.
9
PNG
Vectors vs Bitmaps(4)
SVG 10
Vector Graphics Formats
SVF - Simple Vector Format. Plug-in for CAD drawing representation - 1996. No more development after 1997. Limited, no animation. http://www.softsource.com/svf DWF - Drawing Web Format. Plug-in can be used with Javascript - but with no animation enabled. http://www.autodesk.com/whip/ Flash - Marcomedia’s Vector Graphics Format. The most up to date. Supports full multimedia features. Occupies about 70% of the market. http://www.macromedia.com/software/flash 11
Vector Graphics Formats(2)
VML - Vector Markup Language - based 2D vector format by Microsoft - not developed after 1998. Limited to one single platform - Microsoft.
http://www.w3.org/TR/NOTE-VML WebCGM - computer graphics metafile for the Web - binary format. Primarily designed to visualize technical and scientific drawings. http://www.w3.org/Graphics/WebCGM VRML - Virtual Reality Modeling Language devoted to 3D, supports 2D as well - complicated for simple presentations. Http://www.web3d.org
12
Other Vector Graphics Tools
2D APIs combined with ActiveX - limited to Microsoft platforms.
Java2D - binary program with graphical 2D output - inserted in web pages as applet - platform independent, but requires more than basic scripting programming skills.
13
Motivation for SVG
Text based language.
Simple to program.
Takes advantage of existing tools - XML, CSS, XSL.
Powerful graphics capabilities - high performace, full animation support.
Open standard.
Extendable - MathML for instance.
Searchable.
14
SVG(1)
SVG is a language for describing 2D vector and mixed vector/raster graphics in XML.
Developed by W3C organization.
Supported by Sun, Adobe and IBM.
Plug-in is required.
15
SVG(2)
SVG specification is available in: http://www.w3.org/TR/2000/CR-SVG-20001102/ First draft released: 11/2/1999.
Current status: Candidate Recommendation meaning that the specification is maturing and is now ready for more widespread implementation testing. 16
SVG – Concepts(1)
SVG stands for Scalable Vector Graphics In terms of graphics, scalable means not being limited to single, fixed units.
In terms of Web scalable means that a particular technology can grow to a large number of files, a large number of users, a wide variety of applications. SVG, being a graphics technology for the Web, is scalable in both senses of the word 17
SVG – Concepts(2)
SVG graphics is scalable to different display resolutions and color spaces.
The same SVG graphic can be placed at different sizes on the same Web page, and re-used at different sizes on different pages.
SVG graphics can be magnified to see fine detail, or to aid those with low vision.
18
SVG Code example(1)
Valid SVG document: 19
SVG Code example(2)
Well formed SVG document: