Results 1 to 3 of 3
- 04-25-2012, 02:38 PM #1Member
- Join Date
- Apr 2012
- Rep Power
Need help rotating a non-preset number of images.
I am working on a program currently that scans the files inside a folder, then loads all images from within that folder, and rotate those images 90 degrees before finally displaing them on JFrame.
I've got the file loading and buffered images all sorted out, however I cannot figure out how to rotate an number of images as all options I've found so far involves using Graphics2D which could not be instantiated, meaning I cannot make an array of X number of Graphics2D objects.
Is there a way to make this work?
- 04-25-2012, 05:35 PM #2
Re: Need help rotating a non-preset number of images.
Construct a new BufferedImage with the width/height of the original image's height/width and appropriate type (ususally TYPE_INT_ARGB)
Obtain its associated Graphics / Graphics2D via the appropriate method (read the API)
Rotate the g2D 90° about the center of the image
Draw the original image onto the new image
Nowhere do you needan array of X number of Graphics2D objects.If you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 04-25-2012, 05:36 PM #3
- By sharifiit in forum NetworkingReplies: 0Last Post: 04-30-2011, 09:20 AM
- By sgthale in forum New To JavaReplies: 5Last Post: 04-10-2011, 06:47 AM
- By Unome in forum Java AppletsReplies: 3Last Post: 03-30-2009, 05:55 PM
- By lackofcolor in forum Java 2DReplies: 3Last Post: 02-28-2009, 12:54 AM
- By sciguy77 in forum Java AppletsReplies: 9Last Post: 02-17-2009, 02:47 AM