Wednesday, 31 August 2011

Batik SVG Toolkit


Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation.
The project’s ambition is to give developers a set of core modules that can be used together or individually to support specific SVG solutions. Examples of modules are the SVG Parser, the SVG Generator and the SVG DOM. Another ambition for the Batik project is to make it highly extensible—for example, Batik allows the developer to handle custom SVG elements. Even though the goal of the project is to provide a set of core modules, one of the deliverables is a full fledged SVG browser implementation which validates the various modules and their inter-operability.

What Batik can be used for

Batik use casesWith Batik, you can manipulate SVG documents anywhere Java is available. You can also use the various Batik modules to generatemanipulate and transcode SVG images in your applications or applets.
Batik makes it easy for Java based applications or applets to deal with SVG content. For example, using Batik’sSVG generator module, a Java application or applet can very easily export its graphics into the SVG format. Using Batik’s SVG viewing component, an application or applet can very easily integrate SVG viewing and interaction capabilities. Another possibility is to use Batik’s modules to convert SVG to various formats, such as raster images (JPEGPNG or TIFF) or other vector formats (EPS or PDF, the latter two due to the transcoders provided by Apache FOP).
The Batik toolkit includes the following:
Modules
Tools and applications
See examples of projects and products using Batik for real-life example of how Batik is already integrated in projects and products.

The SVG specification

Scalable Vector Graphics, SVG, is a W3C Recommendation. It defines an XML grammar for rich 2D graphics which includes features such as transparency, arbitrary geometry, filter effects (shadows, lighting effects, etc.), scripting and animation.
The SVG specification states:
This specification defines the features and syntax for Scalable Vector Graphics (SVG). SVG is a language for describing two-dimensional graphics in XML [XML10]. SVG allows for three types of graphic objects: vector graphic shapes (e.g., paths consisting of straight lines and curves), images and text. Graphical objects can be grouped, styled, transformed and composited into previously rendered objects. The feature set includes nested transformations, clipping paths, alpha masks, filter effects and template objects.
SVG documents can be interactive and dynamic. Animations can be defined and triggered either declaratively (i.e., by embedding SVG animation elements in SVG content) or via scripting.

Implementation status

The latest revision of Batik, release 1.7, is a conformant static SVG implementation and supports interactivitylinking and scripting features of the SVG specification. This release supports a nearly complete implementation of declarative animation, too.
See the status page for a detailed description of the set of SVG features Batik supports.

Download Batik

You can get the Batik distribution, source and binary, from the download page.

Java 8 gears up for cloud


Now that Java 7 SE (Standard Edition) has officially been released, Oracle and members of the JCP (Java Community Process) have started mulling over what features to include in the next version of the programming language, Java SE 8. On the agenda for this new release: engineering Java for the cloud.

"Java 8 is supposed to set the scene for the cloud, for a wider deployment arena," said Mark Little, senior director of engineering for Red Hat's middleware business, as well as Red Hat's primary liaison for the JCP. Oracle left out many of the advanced features planned for Java 7 in order not to further delay the release, he noted. Those releases may very well be included in Java 8.

[ Get software development news and insights from InfoWorld's Developer World newsletter. | And sharpen your Java skills with the JavaWorld Enterprise Java newsletter. ]

At least two of those features will prove instrumental in making the next version of Java ready for wide-scale cloud deployment, Little said. One is multitenancy, or the ability for the Java Virtual Machine (JVM) to safely run multiple applications. The other is modularity, or a reorganization of the JDK (Java Development Kit) into a set of cleanly defined though interdependent modules.

"Modularity and true multitenancy within the JVM will be critical for 8 if Java will be dominant in the cloud," Little said.

Modularity is what Red Hat would most like to see in Java 8, Little said. Modularity would cut the size of most Java deployments, because not all deployments need all of Java's core libraries. It would also help developers more easily interact with Java, allowing them to only use the parts they need rather than grapple with the entire codebase.

Modularity would also help with a developer problem that Little describes as "classloader hell."

Developers experience classloader hell when a Java program accesses multiple JARs (Java Archives), or collections of commonly used routines. An app may use a class from one JAR when it actually needs a different version of that class that resides in another JAR. Or it may use a JAR used by another program, and once that other program terminates, the JAR is removed, causing the first application to stop working.

"In order to have modules swapped in and out at will without screwing up the whole environment, you need to have support in the JVM as well," Little said.

One effort, Project Jigsaw, has been working on this goal. When Sun Microsystems controlled Java (Oracle purchased Sun in 2010), that company's engineers preferred Jigsaw over another approach, OSGi (Open Services Gateway initiative), overseen by the OSGI initiative.

Project Jigsaw was slated for Java 7, though it got pulled in 2010 in order to ship Java by 2011, Little said. Nonetheless, either the work from Jigsaw or OSGi should be folded into Java 8, Little predicted. "There will be some modularity present in Java SE 8," he said.

In addition to modularity, Java 8 may also feature multitenancy, or the ability to safely run multiple applications from one JVM.