Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Java Tip 32: You'll flip over Java images -- literally!

Avoid filtering when flipping, scaling, and cropping images -- with Java 1.1

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 2

g.drawImage (im, 
             0, im.getHeight(this), im.getWidth(this), 0,
             0, 0, im.getWidth(this), im.getHeight(this),
             this);


Figure 5: Flipping the image along the vertical and horizontal axes

That's all there is to the new drawImage in Java 1.1. If the image is transparent, you can provide a background color that will seep through. Otherwise, the optional parameter is ignored. Unfortunately, you cannot use drawImage to rotate the image. If you do want to rotate the image, you have to do more work and subclass ImageFilter, just like with Java 1.0.

About the author

Although not a Java drinker (he gets his caffeine fix from Coke), John Zukowski has been consulting for most of the past decade. After founding the Mid-Atlantic Java User Group (MAJUG), John relocated to Boston from Washington, D.C., and is now a Software Mage with MageLang Institute. He is the author of Java AWT Reference from O'Reilly & Associates and the Focus on Java guide at the Mining Company.
  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.