[Home Page] - [Reviews Main] | |
|
Java 2D API Graphics by Vincent Hardy Recommended |
| ISBN: 0 13 014266 2 Publisher: Prentice Hall Pages: 509pp & CD Price: £39-99 |
| Categories: java graphics |
| Reviewed by Peter Pilgrim in C Vu 12-5 (Sep 2000) |
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 the GLF is also freely downloadable from Sun's web site (http://java.sun.com/products/java-media/2D/samples/ ).
To link to this review, please use the URL: http://www.accu.org/bookreviews/public/reviews/j/j002224.htm
Copyright © The Association of C & C++ Users 1998-2000. All rights reserved.