Results 1 to 1 of 1
Thread: Image rotate
- 03-17-2010, 01:33 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 1
- Rep Power
- 0
Image rotate
Hi, i have a proble with rotation of a trasparent backgroud image.
I have an irregular image (ca. 50x40) and i want draw on a graphic context with a .drawImage(), so I load an image 70x70 .png with trasparent back.
Before print image a should rotate of a variable degrees.
At the end of process g2a no have the only the rotate image, but the original orientation of image with print on the new image after rotation.// load image
try {
albatros = ImageIO.read(getClass().getResource("Alba.png"));
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (IllegalArgumentException iae) {
albatros = null;
}
Graphics2D g2a = null;
g2a = (Graphics2D) albatros.getGraphics();
g2a.rotate(-App.item.alfa / 180 * 3.1415, albatros.getWidth() / 2, albatros.getHeight() / 2);
g2a.drawImage(albatros, 0,0,this);
g2a.dispose();
g.drawImage(albatros, (int) App.item.x - albatros.getWidth() / 2, (int) App.item.y - albatros.getHeight() / 2, this);
g.drawLine(x, y, x, y);
g.dispose();
If I load an image with a orizontal line e make 90 degrees rotation I have a + with yours trasparent background, whit the start image down the new rotate.
If I try whit an image whit a define color backgroud is simply, this paint the old image; but whit trasparent don't work fine.
How can help me?
P.S.
Sorry for my Enghlis, it's bad how my java!!
Similar Threads
-
How to rotate an image
By ChipChamp in forum New To JavaReplies: 4Last Post: 06-20-2012, 07:22 PM -
How to rotate catalina.out without restarting tomcat
By kzvi.kzvi.1 in forum Advanced JavaReplies: 1Last Post: 03-25-2010, 06:05 PM -
My rotate 2d pos method isnt working correctly..
By Addez in forum New To JavaReplies: 5Last Post: 12-01-2009, 09:04 AM -
Rotate Image!
By Moncleared in forum AWT / SwingReplies: 1Last Post: 02-11-2009, 05:22 PM -
JFrame rotate
By etheralthougt in forum AWT / SwingReplies: 1Last Post: 10-24-2008, 06:03 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks