Jump to content

SVG: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Other support: Citation for the SVG Web Project
Line 186: Line 186:


=== Other support ===
=== Other support ===
* [http://code.google.com/p/svgweb/ SVG Web] is a JavaScript library for Web developers, dependent on the presence of an installed [[Adobe Flash]] plugin, which provides partial support for SVG 1.1, SVG Animation (SMIL), Fonts, Video and Audio, DOM and style scripting.{{Fact|date=July 2009}}
* [http://code.google.com/p/svgweb/ SVG Web] is a JavaScript library for Web developers, dependent on the presence of an installed [[Adobe Flash]] plugin, which provides partial support for SVG 1.1, SVG Animation (SMIL), Fonts, Video and Audio, DOM and style scripting.<ref>[http://www.theregister.co.uk/2009/06/03/google_svg_internet_explorer/ Google to slip SVG into Internet Explorer], The Register, 3rd June 2009 21:34 GMT</ref>


== Software & support in applications ==
== Software & support in applications ==

Revision as of 09:46, 5 August 2009

Scalable Vector Graphics
Filename extension
.svg, .svgz
Internet media type
image/svg+xml[1]
Developed byWorld Wide Web Consortium
Initial releaseSeptember 4, 2001 (2001-09-04)
Latest release
1.2T
August 10, 2006
Type of formatvector image format
Extended fromXML
Websitew3.org/Graphics/SVG/
This image illustrates the difference between bitmap and vector images. The bitmap image is composed of a fixed set of dots, while the vector image is composed of a fixed set of shapes. In the picture, scaling the bitmap reveals the dots and scaling the vector image preserves the shapes.

Scalable Vector Graphics (SVG) is a family of specifications of XML-based file format for describing two-dimensional vector graphics, both static and dynamic (interactive or animated).

The SVG specification is an open standard that has been under development by the World Wide Web Consortium (W3C) since 1999. SVG images and their behaviours are defined in XML text files. This means that they can be searched, indexed, scripted and, if required, compressed.

SVG is also well-suited to small and mobile devices. The SVG Basic and SVG Tiny specifications were developed with just such uses in mind and many current mobile devices support them.

Since they are XML files, SVG images can be edited with any text editor, but specialized SVG-based drawing programs are also available.

All major modern web browsers except Microsoft Internet Explorer support and render SVG markup directly.[2] To view SVG files in Internet Explorer, users have to download and install a browser plugin.

Overview

SVG has been in development since 1999 by a group of companies within the W3C after the competing standards PGML (developed from Adobe's PostScript) and VML (developed from Microsoft's RTF) were submitted to W3C in 1998. SVG drew on experience designing both those formats.

SVG allows three types of graphic objects:

Graphical objects can be grouped, styled, transformed, and composited into previously rendered objects. SVG does not directly support z-indices[3] that separate drawing order from document order for objects, which is different from other vector markup languages like VML. Text can be in any XML namespace suitable to the application, which enhances searchability and accessibility of the SVG graphics. The feature set includes nested transformations, clipping paths, alpha masks, filter effects, template objects and extensibility.

Since 2001, the SVG specification has been updated to version 1.1 (current Recommendation) and 1.2 (still a Working Draft). The SVG Mobile Recommendation introduced two simplified profiles of SVG 1.1, SVG Basic and SVG Tiny, meant for devices with reduced computational and display capabilities. SVG Tiny later became an autonomous Recommendation (current version 1.2) and the basis for SVG 1.2. In addition to these variants and profiles, the SVG Print specification (still a Working Draft) contains guidelines for printable SVG 1.2 and SVG Tiny 1.2 documents.

Printing

While being primarily designated as a vector graphics markup language, the specification is also designed with the basic capabilities of a page description language, like Adobe's PDF. It contains provisions for rich graphics, and is also compatible with the CSS specification's properties for styling purposes; thus, unlike XHTML and XSL-FO which are layout-oriented languages, SVG is a fully presentational language.[4] A much more print-specialized subset of SVG (SVG Print, authored by Canon, HP, Adobe and Corel) is currently a W3C Working Draft.[5]

Scripting and animation

SVG drawings can be dynamic and interactive. Time-based modifications to the elements can be described in SMIL, or can be programmed in a scripting language (e.g., ECMAScript). The W3C explicitly recommends SMIL as the standard for animation in SVG,[6] however it is more common to find SVG animated with ECMAScript because it is a language that many developers already understand, and it is more compatible with existing renderers. A rich set of event handlers such as onmouseover and onclick can be assigned to any SVG graphical object.

Compression

SVG images, being XML, contain many repeated fragments of text and are thus particularly suited to compression by gzip, though other compression methods may be used effectively. Once an SVG image has been compressed by gzip it may be referred to as an "SVGZ" image, with the corresponding filename extension. The resulting file may be as small as 20% of the original size.[7]

Development history

SVG was developed by the W3C SVG Working Group starting in 1998, after Macromedia and Microsoft introduced Vector Markup Language (VML) whereas Adobe Systems and Sun Microsystems submitted a competing format known as PGML. The working group was chaired by Chris Lilley of the W3C.

  • SVG 1.0 became a W3C Recommendation on September 4, 2001.[8]
  • SVG 1.1 became a W3C Recommendation on January 14, 2003.[9] The SVG 1.1 specification is modularized in order to allow subsets to be defined as profiles. Apart from this, there is very little difference between SVG 1.1 and SVG 1.0.
    • SVG Tiny and SVG Basic (the Mobile SVG Profiles) became W3C Recommendations on January 14, 2003. These are described as profiles of SVG 1.1.[10]
  • SVG Tiny 1.2 became a W3C Recommendation on December 22, 2008.[11]
  • SVG Full 1.2 is a W3C Working Draft. SVG Tiny 1.2 was initially released as a profile, and later refactored to be a complete specification, including all needed parts of SVG 1.1 and SVG 1.2. SVG 1.2 Full adds modules onto the SVGT 1.2 core.
  • SVG Print adds syntax for multi-page documents and mandatory color management support.

Mobile profiles

Because of industry demand, two mobile profiles were introduced with SVG 1.1: SVG Tiny (SVGT) and SVG Basic (SVGB). These are subsets of the full SVG standard, mainly intended for user agents with limited capabilities. In particular, SVG Tiny was defined for highly restricted mobile devices such as cellphones, and SVG Basic was defined for higher-level mobile devices, such as PDAs.

In 2003, the 3GPP adopted SVG Tiny as the mandatory vector graphics media format for next-generation phones. SVGT is the required vector graphics format and support of SVGB is optional for MMS (Multimedia Messaging Service) and PSS (Packet-Switched Streaming Service). [12] [13] [14] It was later added as required format for vector graphics in 3GPP IP Multimedia Subsystem (IMS).[15]

Neither mobile profile includes support for the full DOM, while only SVG Basic has optional support for scripting, but because they are fully compatible subsets of the full standard most SVG graphics can still be rendered by devices which only support the mobile profiles.[16]

SVGT 1.2 adds a microDOM (μDOM), allowing all mobile needs to be met with a single profile.

Functionality

The SVG 1.1 specification defines 14 important functional areas[9] or feature sets:

Paths
Simple or compound shape outlines drawn with curved or straight lines can be filled in or outlined (or used as a clipping path) and are expressed in a highly compact coding in which, for example, M (from 'move to') precedes the initial numeric X and Y coordinates and L (line to) will precede a subsequent point to which a line should be drawn. Further command letters (C, S, Q, T and A) precede data that is used to draw various Bézier and elliptical curves. Z is used to close a path. In all cases, absolute coordinates follow capital letter commands and relative coordinates are used after the equivalent lower-case letters.[17]
Basic Shapes
Straight-line paths or paths made up of a series of connected straight-line segments (polylines), as well as closed polygons, circles and ellipses can be drawn. Rectangles and round-cornered "rectangles" are other standard elements.[18]
Text
Unicode character text included in an SVG file is expressed as XML character data. Many visual effects are possible, and the SVG specification automatically handles bidirectional text (as when composing a combination of English and Arabic text, for example), vertical text (as Chinese was historically written) and characters along a curved path (such as the text around the edges of the Great Seal of the United States).[19]
Painting
SVG shapes can be filled and/or outlined (painted with a color, a gradient or a pattern). Fills can be opaque or have various degrees of transparency. "Markers" are end-of-line features, such as arrowheads, or symbols which can appear at the vertices of a polygon.[20]
Color
Colors can be applied to all visible SVG elements, either directly or via the 'fill', 'stroke' and other properties. Colors are specified in the same way as in CSS2, i.e. using names like black or blue, in hexadecimal such as #2f0 or #22ff00, in decimal like rgb(255,255,127) or as percentages of the form rgb(100%,100%,50%).[21]
Gradients and Patterns
SVG shapes can be filled or outlined with solid colors as above, or with color gradients or with repeating patterns. Color gradients can be linear or radial (circular), and can involve any number of colors as well as repeats. Opacity gradients can also be specified. Patterns are based on predefined raster or vector graphic objects, which can be repeated in x and/or y directions. Gradients and patterns can be animated and scripted.[22]
Since 2008, there has been discussion[23][24] among professional users of SVG that either gradient meshes or preferably diffusion curves could usefully be added to the SVG specification. It is said that a "simple representation [using diffusion curves] is capable of representing even very subtle shading effects"[25] and that "Diffusion curve images are comparable both in quality and coding efficiency with gradient meshes, but are simpler to create (according to several artists who have used both tools), and can be captured from bitmaps fully automatically."[26]
Clipping, Masking and Compositing
Graphic elements, including text, paths, basic shapes and combinations of these, can be used as outlines to define both 'inside' and 'outside' regions that can be painted (with colors, gradients and patterns) independently. Fully opaque clipping paths and semi-transparent masks are composited together to calculate the color and opacity of every pixel of the final image, using simple alpha blending.[27]
Filter Effects[28]
Interactivity
SVG images can interact with users in many ways. In addition to hyperlinks as mentioned below, any part of an SVG image can be made to trigger events representing changes in focus, mouse clicks, scrolling or zooming the image and other pointer, keyboard and document events. Event handlers may start, stop or alter animations and trigger any other scripts in response to these events.[29]
Linking[30]
Scripting
All aspects of an SVG document can be accessed and manipulated using scripts in a similar way to HTML. The default scripting language is ECMAScript (closely related to JavaScript) and there are defined Document Object Model (DOM) objects for every SVG element and attribute. Scripts are enclosed in <script> elements. They can run in response to pointer events, keyboard events and document events as required.[31]
Animation
SVG content can be animated using the built-in animation elements such as <animate>, <animateMotion> and <animateColor>. Animation is also possible by manipulating the DOM using ECMAScript, using the scripting language's built-in timers. SVG animation has been designed to be compatible with current and future versions of Synchronized Multimedia Integration Language (SMIL). Animations can be continuous, they can loop and repeat and they can respond to user events, as mentioned above.[32]
Fonts
As with HTML and CSS, text in SVG may reference external font files, such as system fonts. If the required font files do not exist on the machine where the SVG file is rendered, the text may not appear as intended. To overcome this limitation, text can be displayed in an 'SVG font', where the required glyphs are defined in SVG as a font that is then referenced from the <text> element.[33]
Metadata
In accord with the W3C's Semantic Web initiative, SVG allows authors to provide metadata about SVG images. The main facility is the <metadata> element, where the document can be described using Dublin Core metadata properties (e.g., title, creator/author, subject, description, etc). Other metadata schemas may also be used. In addition, SVG defines <title> and <desc> elements where authors can provide further plain-text descriptive material within an SVG image to help indexing, searching and retrieval by a number of means.[34]

Support for SVG in web browsers

The use of SVG on the web is still limited by the lack of browser support especially by Microsoft Internet Explorer. Web sites that serve SVG images, for example Wikipedia, also have to provide the images in a raster format, either automatically by HTTP content negotiation or by allowing the user to directly choose the file.

Native support

As of 2009, all major Windows browsers have committed to some level of SVG support, except for Internet Explorer even as of version 8.[35][36] Other browsers' implementations are not yet fully functional. See Comparison of layout engines for further details. As of 2008, only Opera and Safari support embedding via the <img> HTML element. Firefox and some other browsers that can display SVG documents currently need them embedding in <object> or an <iframe> elements to display them integrated as parts of an HTML webpage.[37]

Tim Berners-Lee, the inventor of the Web, has been critical of Internet Explorer for its failure to support SVG.[38] All currently supported graphical browsers on Linux systems and the Macintosh have implemented some level of SVG support.

There are several advantages to native support: plugins would not need to be installed, SVG could be freely mixed with other formats in a single document, and rendering scripting between different document formats would be considerably more reliable.

Plugin support

As of 19 March 2009, Internet Explorer 8, the latest release of Windows Internet Explorer, is the only major browser not to provide native SVG support. Internet Explorer requires a plugin to render SVG content. There are a number of plug-ins available to assist including:

  • Adobe SVG Viewer from Adobe Systems plugin supports most of SVG 1.0/1.1. Zooming and panning of the image are also supported to enable viewing of any area of the SVG lying outside the visible area of its containing window, but scrolling is not supported. Adobe SVG Viewer is available for download from Adobe Systems free of charge.[43] However, on 1 January 2009, Adobe Systems discontinued support for Adobe SVG Viewer.[44] Support for pre-3.0 versions of Safari is only available on PowerPC.[citation needed]
  • RENESIS Player 1.0 for Internet Explorer from examotion GmbH, first released on April 2008, supports SVG 1.1 on IE 6.x and 7.x and is available for download free of charge.[45]
  • Ssrc SVG Plugin from Savarese Software Research Corporation is a plugin for rendering SVG and XUL in Microsoft Internet Explorer (MSIE) versions 6, 7, and 8 on Windows XP, Server 2003, Vista, and Server 2008. In addition, the plugin enables Internet Explorer to load Mozilla XUL applications.[46]

Other support

  • SVG Web is a JavaScript library for Web developers, dependent on the presence of an installed Adobe Flash plugin, which provides partial support for SVG 1.1, SVG Animation (SMIL), Fonts, Video and Audio, DOM and style scripting.[47]

Software & support in applications

Images are usually automatically rasterised using a library such as ImageMagick, which provides a quick but incomplete implementation of SVG, or Batik, which implements nearly all of SVG 1.1 and much of SVG Tiny 1.2 but requires the Java Runtime Environment.

  • Inkscape is a free software SVG drawing program for Linux, Microsoft Windows and Mac OS X.
  • The Batik SVG Toolkit can be used by Java programs to render, generate, and manipulate SVG graphics.
  • xfig and gnuplot allow export of SVG drawings.
  • The GNOME project has had integrated SVG support throughout the desktop since 2000.
  • OpenOffice.org Draw can export SVG drawings. Import extensions are available to import SVG images into OpenOffice.org Draw.[48]
  • Go-oo Draw (OpenOffice.org variant) can open and export SVG files.[49]
  • OxygenOffice Draw (OpenOffice.org variant) can open and export SVG files.[50]
  • Adobe Illustrator supports both the import and export of SVG images. When writing SVG files it has the option to embed a copy of the associated proprietary Illustrator format for later editing. This often results in changes being lost if another editor is used then the file is reopened in Illustrator because it ignores everything but the embedded Illustrator file.
  • CorelDRAW has an SVG export and import filter.
  • Xara Xtreme has an SVG export and import filter in both its free/open-source and pay versions.
  • Microsoft Visio can save files in the SVG format as well as the SVG compressed format.
  • The GIMP allows SVG images to be imported as paths or rendered bitmaps.
  • Blender will import SVG graphics as paths.
  • Cairo is a vector graphics based library which can generate SVG. It has bindings for many programming languages including Haskell, Java, Perl, Python, Scheme, Smalltalk and several others.
  • Altsoft Xml2PDF allows converting SVG files to PDF, PS, various GDI+ formats.
  • Ecava IntegraXor [51] created SAGE [52] (SCADA Animation Graphic Editor) which allows SVG graphic to be used in SCADA application.
  • Kiyut's Sketsa is a mature commercial SVG editor.
  • Examotion's RENESIS Player is a free SVG browser for windows. Its Windows Thumbnail Plugin allows the generation of thumbnail previews in any Windows Explorer window.

Mobile support

On mobile, the most popular implementations for mobile phones are by Ikivo and Bitflash, while for PDAs, Bitflash and Intesis have implementations. Flash Lite by Adobe optionally supports SVG Tiny since version 1.1. At the SVG Open 2005 conference, Sun demonstrated a mobile implementation of SVG Tiny 1.1 for the Connected Limited Device Configuration (CLDC) platform.

Mobile SVG players from Ikivo and BitFlash come pre-installed, i.e., the manufacturers burn the SVG player code in their mobiles before shipping to the customers. Mobiles also can include full web browsers (such as Opera Mini and the iPhone's Safari) which include SVG support.

The level of SVG Tiny support available varies from mobile to mobile, depending on the manufacturer and version of the SVG engine installed. Many of the new mobiles support additional features beyond SVG Tiny 1.1, like gradient and opacity; this standard is often referred as SVGT 1.1+.

Nokia's S60 platform has built-in support for SVG. For example, icons are generally rendered using the platform's SVG engine. Nokia has also led the JSR 226: Scalable 2D Vector Graphics API expert group which defines Java ME API for SVG presentation and manipulation. This API has been implemented in S60 Platform 3rd Edition Feature Pack 1 onward.[53] Some Series 40 phones also support SVG (such as 6280).

Most Sony Ericsson phones beginning with K700 (by release date) support SVG Tiny 1.1. Phones beginning with K750 also support such features as opacity and gradients. Phones with Java Platform-8 have support for JSR 226.

SVG is also supported by other models from Motorola, Samsung, LG, and Siemens.

See also

References

  1. ^ M Media Type registration for image/svg+xml
  2. ^ Svensson, Peter (2008-09-10). "Creator of Web spots a flaw in Internet Explorer". msnbc.msn.com. Retrieved 2008-11-16.
  3. ^ SVG(W3C) § 4.2-Drawing Order
  4. ^ "SVG as a Page Description Language", presentation given at SVG.Open 2002, Zürich, Switzerland
  5. ^ SVG Print 1.2 Working Draft
  6. ^ Paul Festa (2003-01-09), W3C releases scripting standard, caveat, CNET.com
  7. ^ Saving compressed SVG (SVGZ)
  8. ^ W3C Recommendation, SVG 1.0 Specification (2001-09-04)
  9. ^ a b W3C Recommendation, SVG 1.1 Specification (2003-01-14)
  10. ^ Mobile SVG Profiles: SVG Tiny and SVG Basic, W3C Recommendation 14 January 2003
  11. ^ Scalable Vector Graphics (SVG) Tiny 1.2 Specification, W3C Recommendation 22 December 2008
  12. ^ SVG in 3GPP Multimedia Messaging and Streaming Services (version March 2003)
  13. ^ 3GPP (2002-12) 3GPP Multimedia Messaging Service (MMS); Media formats and codecs (Release 5); 3GPP TS 26.140 V5.2.0 (2002-12); Technical Specification (ZIP). Retrieved on 2009-06-01.
  14. ^ 3GPP (2003-03) 3GPP Transparent end-to-end Packet-switched Streaming Service (PSS); Protocols and codecs (Release 5); 3GPP TS 26.234 V5.4.0 (2003-03); Technical Specification (ZIP). Retrieved on 2009-06-01.
  15. ^ ETSI (2009-01) ETSI TS 126 141 V8.0.0 (2009-01); 3GPP TS 26.141; IP Multimedia System (IMS) Messaging and Presence; Media formats and codecs Page 10. Retrieved on 2009-06-02.
  16. ^ Listing of phones that support SVG
  17. ^ SVG specification, "Paths"
  18. ^ SVG specification, "Basic Shapes"
  19. ^ SVG specification, "Text"
  20. ^ SVG specification, "Painting: Filling, Stroking and Marker Symbols"
  21. ^ SVG specification, "Color"
  22. ^ SVG specification, "Gradients and Patterns"
  23. ^ "IRC log of svg on 2008-11-17". W3C. 2008. Retrieved 2009-05-25. DS: Priorities should be layout, diffusion curves, 2.5D and make sure we work well with CSS on that
  24. ^ "Propositions for the next SVG spec". W3C. 16 Mar 2009. Retrieved 2009-05-25. Indeed, we do plan to add new gradient capabilities to SVG in the next version, and we are looking into diffusion curves, which I think will meet your needs … *Diffusion curves* seems really a great idea.
  25. ^ Rusin, Zack (2008). "SVG in KDE: Freedom of Beauty". svgopen.org. Retrieved 2009-05-25.
  26. ^ Orzan, Alexandrina (2008). "Diffusion Curves: A Vector Representation for Smooth-Shaded Images" (PDF). ACM Transactions on Graphics (Proceedings of SIGGRAPH 2008). 27. Retrieved 2009-05-25. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help)
  27. ^ SVG specification, "Clipping, Masking and Compositing"
  28. ^ SVG specification, "Filter Effects"
  29. ^ SVG specification, "Interactivity"
  30. ^ SVG specification, "Scripting"
  31. ^ SVG specification, "Animation"
  32. ^ SVG specification, "Fonts"
  33. ^ SVG specification, "Metadata"
  34. ^ Windows Internet Explorer 8 Expert Zone Chat (June 19, 2008)
  35. ^ Schiller, Jeff (2008-09-03). "SVG Support". Retrieved 2008-11-16.
  36. ^ "SVG image not shown by Firefox". mozilla.dev.tech.svg. 25 Feb 2009. Retrieved 2009-05-27.
  37. ^ "Creator of Web spots a flaw in Internet Explorer". Associated Press. 2008-09-10.
  38. ^ SVG in Firefox
  39. ^ Mozilla SVG Status
  40. ^ SVG improvements in Firefox 3
  41. ^ The official WebKit SVG status page
  42. ^ Adobe SVG Viewer download area
  43. ^ Adobe SVG Viewer End of Life announcement
  44. ^ "RENESIS Player – Fast, easy and smart". examotion GmbH. Retrieved 30 May 2009.
  45. ^ "Ssrc SVG: SVG Plugin for Internet Explorer". Savarese Software Research Corporation. Retrieved 30 May 2009.
  46. ^ Google to slip SVG into Internet Explorer, The Register, 3rd June 2009 21:34 GMT
  47. ^ SVG import extension for OpenOffice.org
  48. ^ SVG import filter in Go-OO
  49. ^ SVG import filter in OxygenOffice
  50. ^ Ecava IntegraXor
  51. ^ SAGE Documentation
  52. ^ S60 Product info