ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1949 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Java 2D API Graphics
Author:
Vincent Hardy
ISBN:
0 13 014266 2
Publisher:
Prentice Hall
Pages:
509pp&CD
Price:
£39-99
Reviewer:
Peter Pilgrim
Subject:
java; graphics
Appeared in:
12-5
This is book is about the Java 2D API that provides the underlying support for advanced graphics in the Java 2 platform standard edition (J2SE). It was written by one of the Sun Engineers so you would expect it to be a decent book. This is a quality book simply because it make use of colour printing (perhaps that is also why it is expensive, twice the price of Jonathan Knudsen's for instance) and almost all of the illustrations are in colour. The book is divided into three parts. Part I contains an overview of the Java 2D API. Part II is a more detailed study of the API. Finally Part III is all about the author's extension to the Java 2D API; his very own original graphics layer framework, GLF. The book is 510 pages long and 17 chapter in length. Parts I and II cover the first six chapters and the first 196 pages. So you can see that the most of the book is devoted to Hardy's GLF. If you have ever looked at the GNU Image Manipulation Program (GIMP) or dabbled with one of the PhotoShop or similar commercial packages then you have probably wondered how it is done, how the graphics actually works. If you want to know about the complexities of feathering a shape or adding a black drop shadow behind a head line text then the GLF is definitely for you. Especially if you want to create that sort thing in Java.

So what is the Java 2D API? It is the new API included by default on the latest JDK release (1.2 and now 1.3 and soon to be released 1.4). It is a sophisticated API that allows the programmer to write a graphics program that draws complex shapes with arbitrary strokes and fill them with different paints. It is possible to rotate, scale, shear or Affine transform any shape or image. In short you take this 2D API and draw text, composite images, render inside and out and clip to any general path shape. Thus the first chapter presents a general overview.

The secret in this box of tricks is the new Java class called

java.awt.Graphics2D
and the second chapter illustrates this with many short examples of the rendering methods available. The second chapter begins a more detailed look at the overall API. Starting with shape rendering and finishing with buffered images this chapter gets kudos especially for introducing early the buffered image operations; the standard Affine transformations, rescaling, colour look-ups and convolution operations. The chapter describes how to apply these effects to the Graphics2D object class. There are graphic context attributes where you can control how primitives such as fonts are rendered or composited on top (or under) another graphic.

Chapter three describes how to render to an output device for example a printer device or off-screen buffer. Buffers are typically used to provide flicker-free displays in animation. Chapter four is an exceptionally good tutorial. Hardy demonstrates how to manipulate and render shapes, images and text primitives. The author gets under the skin of the graphic context attributes in the fifth chapter and this could be considered as intermediate-to-advanced level.

The rest of the book is really about the Graphics Layer Framework. So what is the GLF? It is a framework for providing higher level rendering operations in the form of layers. Graphics are manipulated in layers, which means you need to have a thorough understanding of compositing and the facilities in the Java 2D to really appreciate what is going on. There are basically four types of layers; namely

ShapeLayer, ImageLayer,
TextLayer
and
CompositionProxyLayer
. Think of the laminations that used to be involved in traditional cartoon making and you will get the idea. With the GLF you can move (translate) a layer, rotate it, rescale it or shear it to create a digital effect.

Overall, I would say this book is for advanced graphics enthusiasts. It is easier to think of this purchase as getting two books in one with a handy CD-ROM thrown it. If you are looking for a quick introduction to the Java 2D, feel confident enough about your programming to wade the high waters and more importantly if the GLF excites you then buy this book. The GLF code is included on the CD-ROM together with all examples from the book. If you would rather try and then buy theGLF is also freely downloadable from Sun's web site (http://java.sun.com/products/java-media/2D/samples/).