Scalable 2D Vector Graphics API overview

Scalable Vector Graphics (SVG) is a language defined by the World Wide Web Consortium (W3C) for describing 2D graphics in XML format. It supports rich graphical content through three types of objects: vector shapes, raster images and text.

Due to industry demands, two mobile profiles were introduced with SVG 1.1: SVG Tiny (SVGT) and SVG Basic (SVGB). These are smaller subsets of the full SVG standard, intended for user agents with limited capabilities.

Of these two, SVG Tiny was defined for highly restricted mobile devices such as cell phones, whereas SVG Basic was defined for higher level mobile devices, such as PDAs. 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. For more information about SVG in general, see the SVG overview on the W3C website.

In a vector graphic system, an image is described as a set of geometric shapes (objects). Rather than receiving a finished set of pixels as in a raster graphic system, a vector viewing program receives commands for drawing shapes at specified sets of coordinates. Vector graphics work by describing the grid points at which lines or curves are to be drawn. They can be described as a set of instructions for a drawing, whereas bitmap graphics (rasters) are points of color in specific places.

Vector graphics recognize what they are, a triangle recognizes itself to be a triangle and text likewise recognizes that it's text. Being objects rather than a set of pixels, vector objects can change their shape and color, whereas bitmap graphics cannot. Also, since all "text" really is text, no matter how it looks or how it is rotated or transformed, it can be searched, for example.

The SVG content is stored into a Document Object Model (DOM) document. It can be traversed, access the values and modify the content. For more information about the DOM used in the M2G API, see the W3C DOM specification.

The Scalable 2D Vector Graphics (JSR-226) API (M2G) that this Developer's Guide concerns uses SVG Tiny 1.1 Profile Specification. It is designed to be a compact, yet powerful API, and is targeted for low-end mobile devices with constraints in memory, screen size, and computational power. It is used as a Java™ interface to native SVG engine for rendering Scalable 2D vector images, including external images in SVG format. For more information, see the M2G API specification. You may also want to read the Scalable 2D Vector Graphics API (JSR-226): Implementation Notes for the Nokia Asha and Series 40 implementations.