One weakness of Java has been its graphics capabilities. Java 1.0 and 1.1 only included simple primitives for line drawing: lines could only be one pixel wide, they could only be solid, and there wasn't any good way to draw curves. Font management and color management were also weak. Java 2D (collectively called the "2D API") signals a major improvement in Java's graphics capabilities. It covers many of the classes in Java 1.2 that address graphics handling and improves on many weaknesses that were present in the previous versions of Java.The 2D API allows you to produce high-quality, professional images on a screen or printer. Java 2D Graphics describes the 2D API from top to bottom, demonstrating how to set line styles and pattern fills as well as more advanced techniques of image processing and font handling. You'll see how to create and manipulate the three types of graphics objects: shapes, text, and images. Other topics include image data storage, color management, font glyphs, and printing.Java 2D Graphics assumes no prior knowledge of graphics. Chock full of detailed explanations and examples, this book provides beginning Java programmers with a solid foundation in 2D graphics and helps more advanced programmers create and use high-quality images in their applications.Topics covered in the book include:
The rendering pipeline
Shapes and paths
Painting with solid colors, gradients, and textures
Stroking paths, including dashed lines
Transformations: translation, rotation, shearing, and scaling
Jonathan Knudsen is an author at O'Reilly & Associates. His books include The Unofficial Guide to Lego Mindstorms Robots, Java 2D Graphics, and Java Cryptography. He is the Courseware Writer for LearningPatterns.com.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Java 2D Graphics is a John Dory fish. The name John Dory fish, or dory, can refer to about 10 species of marine fish in the Zeidae family. They can be found in the temperate waters of oceans worldwide. Adults tend to stay on or near the ocean floor, in depths ranging from the shore to 650 feet. Young dories often hide in seaweed. Most species are about 1–2 feet long, though some can grow up to 3 feet. The largest weigh around 20 pounds.All dories have the same odd look: a large, pouty mouth and a body that is deep but extremely thin from side to side. Their anterior dorsal fin is made up of several spines. Instead of regular scales, they have large modified scales called scutes. They are usually silvery or yellow in color and have a dark spot on each side of their fattened body.The John Dory's strange appearance aids in hunting. Though weak swimmers, they feed on small fish and crustaceans. A dory will carefully approach his prey by trembling his anal and dorsal fins. Because his body is so thin and light-reflective, he goes unnoticed until he shoots out his large, protruding mouth and catches the unsuspecting fish.The origin of the John Dory's name is a subject of debate. Some believe it derives from the French jaune d'oree ("with a yellow edge"), in reference to the fish's coloring. The function of the dark spot on the dory's side is also unknown, though some local legends claim it is the thumbprint of Saint Peter, left when he held one to take a coin from its mouth. Nicole Arigo was the copyeditor and production editor for Java 2D Graphics. Sarah Jane Shangraw was the proofreader. Maureen Dempsey, Melanie Wang, and Sheryl Avruch provided quality control reviews. Nancy Crumpton wrote the index.The cover was designed by Emma Colby using a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font. The color insert was designed by Hanna Dyer. The inside text layout was designed by Nancy Priest.Text was produced in FrameMaker 5.5 using a template implemented by Mike Sierra. The heading font is Bodoni BT; the text font is New Baskerville. The illustrations that appear in the book were created in Macromedia Freehand 8 and Adobe Photoshop 5 by Robert Romano. This colophon was written by Sada Preisch.
Past reviewers trash the book as being outdated and as having too few examples. Beginning from the first chapter to the last, you need not look far for useful, reusable code. It may seem trivial now (not) to integrate an arbitrary graphics canvas along with Swing, but this book shows you concisely and pedagogically.
You will learn some graphics tricks too, like looping over shapes while cycling colors, gradient rectangles and "photo editing"-type filters. The author takes great pains to use Rectangle2D and to modularize his methods. This is received gratefully.
This is a great reference and self-study text. If you are interested in bridging the gap between college-level/intermediate Java and games, this book lets you elevate your apps beyond simple forms.
The length of the book is perfect. The author exhaustively mentions important, useful methods. Examples are relevant - they might as well be features in any graphics app worth writing.
Bottom Line Yes, I would recommend this to a friend
Good book, and was very relevant two years ago, but has lost its impact. With Java moving forward, this book really needs a new, updated edition that covers Swing components as well as other projects such as SVG/Batik.
If one needs to understand text fairly well an approach to consider is reading books such as Java Swing, Swing, and the text and related parts of Java 2D Graphics so as to approach the topic from 2 opposite directions. I feel comfortable with that approach after not being able to get to sufficient depth with the former books (although what they present is also essential to know). Though providing depth, Java 2D Graphics makes the subject fairly simple and clear.
A newer addition that integrates Swing fully into the examples would be nice. This edition probably was written when both Swing and 2D Graphics were not yet completed as are most books on new computer subjects. That is understandable.
absolutely useless! far too few examples and the examples are all too big. also there little discussion on what goes on in the java 2d api and too many function descriptions - THIS IS WHAT THE JAVA DOCS ARE FOR -.