Java Reference
In-Depth Information
Introducing the Java Scalable 2D Vector
Graphics API
These days, the idea of multimedia encompasses audio and video from analog sources,
such as Hollywood movies, MP3 files of the Grateful Dead bootlegs, or photo snapshots
from your camera phone. All-digital multimedia is booming, however, in the form of the
SVG format. SVG is an open XML specification for describing two-dimensional vector
graphics images that may be static or may include animation and support for user inter-
action. To compete with Adobe's Shockwave Flash (SWF) format, the mobile industry is
widely adopting a subset of the SVG format, called SVG Tiny, for wireless terminals and
other devices.
Understanding Basic SVG Concepts
The SVG format lets you represent an image using objects such as labels, circles, lines,
polygons, and curves. Unlike the images to which you're probably accustomed, such as
PNG, GIF, BMP, or JPEG images (which are called bitmap or raster images because they're
composed of rows of individual picture elements), the SVG format is a vector format that
uses a mathematical description of the shapes that make up an image. In addition, SVG
images can contain bitmap data as well. This information is expressed using XML as
defined by the W3C; for information on the specific standards, consult
http://www.w3c.org/TR .
Because SVG is a vector format, images represented using SVG don't show scaling
artifacts when rendered at different resolutions the way bitmap images do. Moreover,
the standard explicitly provides support for animated images, letting artists create ani-
mations that render well on different-sized screens. Even more useful, SVG includes
support for an event model that lets SVG images exchange events with the container
that renders the image, so it's possible to express the look and feel of an entire user
interface using SVG. SVG documents can also include scripts to handle events, making
it a full-blown graphical authoring environment in its own right. Many browsers and
other applications provide support for SVG already, making it a powerful standard with
wide industry adoption.
JSR 287 defines an optional set of packages that support rendering and creating
SVG images that comply with the SVG Mobile 1.2 standard (also known as SVG Tiny 1.2,
described by the W3C at http://www.w3.org/TR/2003/REC-SVGMobile-20030114/ ). This stan-
dard eliminates two key features of SVG—support for scripts, and filters that the render
can apply on a vector graphic to produce a modified bitmap output—as well as a few
other limitations on clipping and transparency.
SVG is an XML application, so it's possible for you to create SVG content using noth-
ing more than a text editor. Listing 16-11 shows an example.
 
Search WWH ::




Custom Search