Sun Java Solaris Communities My SDN Account Join SDN
 

Mobile Service Architecture - JSR 226

»  Overview
 
»  Devices
 

JSR 226 - 2D Scalable Vector Graphics API for J2ME 1.1

 

The Scalable 2D Vector Graphics API specification defines an API for rendering 2D graphics in the World Wide Web Consortium (W3C) Scalable Vector Graphics (SVG) Tiny format. SVG makes it possible for developers to create interactive graphical content, with the ability to zoom and resize on displays with different resolutions and aspect ratios. JSR 226 also defines a subset of the Micro Document Object Model (uDOM) API to allow user interaction and dynamic manipulation of SVG content.

Compared with raster graphics, SVG is much more scalable because it allows for zooming without loss of quality, an important feature in applications such as mapping or when looking at pictures on a small wireless device screen. SVG also enable users to search for text within a graphic, making application interfaces more interactive. A classic example of this capability is searching for a street name within a map. Applications that take advantage of JSR 226 can store, load, layer, manipulate, and render 2D graphics, creating a more dynamic and rich user experience.

With JSR 226 developers can take advantage of the large amount of available SVG content. Because SVG is based on the eXtensible Markup Language (XML), a developer accustomed to a scripting environment can also take advantage of the robust features offered by a full programmatic environment, such as the Java language.

Packages

 

javax.microedition.m2g
org.w3c.dom
org.w3c.dom.events
org.w3c.dom.svg

System Properties

 
Name Description
microedition.m2g.version Version of the Scalable 2D Vector Graphics API supported by the device. For example, "1.0" or null.

microedition.m2g.svg.baseProfile The base profile of SVG that is supported. It is "tiny" for JSR 226 v1.0.

microedition.m2g.svg.version The version of SVG that is supported by the underlying implementation. For example if the underlying engine conforms to W3C SVGT 1.1, the returned string is "1.1".
 

Articles

 

Getting Started with Mobile 2D Graphics for J2ME - The Scalable 2D Vector Graphics API (JSR 226) brings compact 2D graphics to the Java ME platform. JSR 226 enables the application to create, display and modify scalable vector graphic (SVG) content on a MIDP device. The compact and scalable aspect of vector images are a natural fit for mobile applications.

An Introduction to SVG is the "101" article for everyone new to scalable vector graphics. The article presents the basics of the file format with graphical elements to illustrate their use.

An Introduction to the Scalable 2D Vector Graphics API (JSR 226) builds on the Intro to SVG article with a dozen "how-to" examples - code and graphics included.

JSR 226 Demos are 8 working examples of SVG features.

SVG GUI Makeover of th eYahoo! Local Business Search application is a complete example of ditching the javax.microedition.lcdui.* package in favour of SVG. Examples - yes, source code - yes.

Getting Started
 
Related Links