http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Overview
FAQ
Demo
License
Download
Install

Viewer
Rasterizer
SVG Applet
Generator

Who we are
Status
CVS Repository
Mail Archive
Bug Database

Glossary
Regression tool
API (Javadoc)




Answers
What is Batik?

Batik use cases Batik is a Java based toolkit for applications which handle images in the Scalable Vector Graphics (SVG) format for various purposes, such as viewing, generation or manipulation.

The project's ambition is to give developers a set of core modules which can be used together or individually to support specific SVG solutions. Examples of modules are an SVG parser, an SVG generator and an SVG DOM implementations. Another ambition of the Batik project is to make it highly extensible (for example, Batik allows the developer to handle custom SVG tags). Even though the goal of the project is to provide a set of core modules, one of the deliveries is a full fledged SVG Viewer implementation which validates the various modules and their inter-operability.

In a nutshell, Batik provides building blocks that developers can assemble in various ways in their Java technology applications to generate, parse, view or convert SVG contents. For example, Batik contains a Swing component that can add SVG viewing capability to all Java technology applications. Batik can also be used to generate SVG on a client or on a server, and Batik can convert SVG content into other formats such as JPEG or PNG. Batik's goal is to make it easy for application developers to handle SVG content for various purposes, client-side or server-side, as illustrated in the above diagram.


What is SVG?

SVG (Scalable Vector Graphics) is an open-standard language for describing two-dimensional (2D) graphics in XML. It is a Candidate Recommendation from the W3C. SVG lets you describe rich images with features such as gradients, transparency, filter effects and animation.

SVG allows for three types of graphic objects: shapes (e.g., paths consisting of straight lines and curves), images and text. Graphical objects can be grouped, styled, transformed and composited (e.g., drawn with transparency). SVG has a large set of static features that includes nested transformations, clipping paths, masking and filter effects.

In addition, SVG images can be dynamic and interactive. A rich set of event handlers such as onmouseover and onclick can be assigned to any SVG graphical object. These handlers can invoke scripts, which, in response to an event, can dynamically modify the SVG graphic through the SVG Document Object Model (DOM) API, allowing, for example scripts to change the color or location of graphical elements in reaction to events.

SVG graphical elements can also be animated through scripting. Alternatively, animation sequences can be expressed directly in XML because SVG leverages the SMIL specification for multimedia, another W3C specification.


What can I do with Batik?

Batik contains several modules that can be used independently such as an SVG parser, a object oriented vector tookit (GVT) and a set of extensions to the Java 2D API (such as sophisticated fill types and filter effects).

However, Batik comes with three packaged applications: an SVG viewer (in the org.apache.batik.apps.svgviewer package) an SVG rasterizer (in the org.apache.batik.apps.rasterizer package) and an SVG Generator (in the org.apache.batik.util.awt.svg package) that allows all Java applications to export their graphics to the SVG format.

The SVG viewer can display SVG documents and lets the user zoom, pan and rotate any SVG document, view the SVG source, link between SVG documents, view a tree representation of the SVG DOM and more. One important component of the SVG viewer is the JSVGCanvas component that can be plugged in any Java application to provide SVG viewing capability.

The SVG rasterizer lets the user convert SVG files to raster formats such as JPEG and PNG. It contains an extensible mechanism so that arbitrary raster formats can be added. For example, the rasterizer lets you create one SVG file with a specical effect (e.g., shadows, gradients, etc...), turn it into an PNG image, then modify the SVG source (e.g., modify a piece of text or a color), and generate another PNG image from it. This way, you can easily generate a series of images sharing a common theme or look and feel to post on a web site (note that the rasterizer can also be used on a web server to do this conversion automatically).

The SVG generator lets all Java application export their graphics as SVG, with no more requirements than for drawing to the screen or for printing. For example, if you have an application that displays a pie chart in a window, you can use the SVG generator to simply export that pie chart to the SVG format (with no more work than for printing that pie chart or drawing it to the screen).

These three applications show that Batik can be used client side (the viewer can be used on any client machine, and the SVG generator can be used in client desktop applications to export SVG) and server side (the rasterizer can be used to serve SVG images to client machines that do not have SVG support; the SVG generator can be used to dynamically generate SVG content on a server).

The SVG viewer and the rasterizer are only examples of the type of applications Batik allows. Its architecture allows the different modules to be used in different ways and other applications are possible, such as transcoders (to other vector formats, such as PDF, for example). Furthermore, the Graphic Vector Toolkit could be used to render other graphic formats such as XHTML.


How can I see a demo?

You can either download Batik and run the viewer or follow this link to see an on-line demo of Batik's capabilities.

You can also see screenshots of the Batik SVG viewer, images created from the rasterizer and an example of how to use the SVG Graphics2D generator.


Why do we have such a project at Apache?

Apache's mission is to allow the web to be an open environment and to remain an open environment. Batik is an open source implementation of a key format for today and tomorow's web and fits well in Apache's mission.


How does Batik relate to other Apache projects?

Batik will likely be used in Cocoon for server side rasterization of SVG images. In addition, the Batik and the FOP teams have started to work together to define how the projects can leverage each other's work for SVG to PDF conversion.

Note that Batik uses Xalan for its support of XSL transformations (have a look at the xsltest.svg file in the distribution).


How did it start?

Batik started out because several teams doing SVG related projects decided to join efforts with the idea that the whole will be greater than the sum of the parts. The following companies or institutions are part of the team that contributed and/or created the initial Batik project:

In addition, the Batik project is supported by IBM.

We encourage anyone to participate. As with all ASF project, all efforts are volunteer-based. We are looking for individuals to work with us on fulfilling our goals for Batik in the spirit of collaborative open-source software development.


How can I contribute?

The Batik Project is an open volunteer project based on the spirit of the Apache Software Foundation (ASF). This means that there are lots of ways to contribute to the project, either with direct participation (coding, documenting, answering questions, proposing ideas, reporting bugs, suggesting bug-fixes, etc..) or by resource donation (publicity, hardware, software, conference presentations, speeches, etc...). Applications that use the Batik modules, such as tools or extensions, are of special interest to the project.

The process for contributing to Batik is the same as for other Java projects at Apache. A formal description of that process can be found on the Jakarta web site.

For direct participation, we suggest you to subscribe to the Batik mailing list (follow the link for information on how to subscribe and to access the mail list archives), and to checkout the latest code.


Where is Batik going? What is next?

The SVG implementation is not complete, and there is more work to do to achieve a fully functional viewer, especially in dynamic behavior (the scripting support is not fully implemented yet and there is no SMIL animation support yet).

The type of applications (e.g., transcoding applications) that can or will be added to Batik depends on contributions and feedback.


How can I create and author SVG content?

Well, you can always use a plain text editor such as vi or xemacs, but there are many graphic authoring packages that can export SVG documents and that will let you author SVG content visually.

You can get a list of tools that can export SVG from the implementation section of the SVG Home page on the W3C web site. You can also imagine building a tool on top of Batik: feel free to contribute!

Authoring is one way of creating SVG content, and graphic authoring packages are useful for that purpose. However, there are many types of graphics which can be generated, such as stock quotes, statistical data, etc. For these types of graphics, there are many ways to generate SVG content. For example, if your data (say stock information) is contained in an XML document, you could use XSLT to transform your XML data into SVG. If your data comes from a database and you retrieve that data in a servlet on a Web server (e.g., using JDBC), you could use the Java binding for the DOM API to generate an SVG document from the data base data. You could also use Batik's SVG generator and use the Java 2D API to generate that graphic.

The following URLs will be useful to learn more about each of these solutions:


What other SVG products are out there?

There are many companies supporting SVG and you will find a list of available implementations on the W3C's SVG implementation page


Where can I find the SVG specification?

The SVG specification is available from the W3C Web site


How much of SVG does Batik implement?

The following status page shows how much of the SVG specification Batik implements by showing which of the tests in the SVG Basic Effectivity test suite Batik successfully passes.


What are the benefits of SVG being an XML grammar?

Being an XML grammar means SVG can leverage work done around XML, and SVG actually leverages other grammars such as XLink for linking and SMIL for the animation.

Beyond the use and mix with other XML syntaxes, being an XML grammer lets SVG benefit from the pletora of XML tools that make it so easy to manipulate, generate, search and edit SVG files.


Where does the name come from?

Batik is one of Java's famous and highly developed art traditions. Batik is generally thought of as the most quintessentially Indonesian textile. Motifs of flowers, twining plants, leaves buds, flowers, birds, butterflies, fish, insects and geometric forms are rich in symbolic association and variety; there are about three thousand recorded batik patterns.

We think that Batik evokes gracefully Java, graphics and high-quality, terms that constitute the core of the toolkit.

The following page shows examples of what Batik textures look like.


What are the System Requirements to run Batik?

Batik is written in the Java language and requires a version 1.2.2 implementation. However, version 1.3 is highly recommended, as that version fixed several problems that improved performances a lot.


How do I install Batik?

You will need the JDK 1.3 (or 1.2.2 if 1.3 is not yet available on your platform) to run Batik.

To install Batik you need to download the binary or source distribution and unzip it on your computer.

Once Batik is installed, you need to enter the command "batik" in the directory where you unpacked the distribution.

You can have a look at the installation instructions for more help on this.


Which JDK version do I need?

Batik is written in the Java language and requires a version 1.2.2 implementation. However, version 1.3 is highly recommended, as that version fixed several problems that improved performances a lot.


How do I submit patches or bug fixes?

You can submit bug fixes and patches to the Batik developers mailing list.


What scripting languages can I use in my SVG files?

A limited support of scripting in SVG files is provided with the current version of Batik (script are executed but the dynamic update is not fully supported).

Batik can recognized the following scripting languages:

  • ECMAScript thanks to the Mozilla Rhino JavaScript engine included in the distribution.
  • Python for which you need to download the JPython engine.
  • Tcl for which you need to download the Jacl engine.

To get more information on how to install optional scripting languages you can have a look at the installation instructions.




Copyright © 2000 The Apache Software Foundation. All Rights Reserved.