Results 1 to 3 of 3
  1. #1
    natdizzle's Avatar
    natdizzle is offline Nathan Nelson
    Join Date
    Jan 2009
    Posts
    105
    Rep Power
    0

    Post java.awt.geometry - Rotating an Image with AffineTransform

    Hi,

    I'm rotating an image with AffineTransform the code basicly looks like:

    Java Code:

    Java Code:
    AffineTransform aff = new AffineTransform();
    g2d.drawImage(MyImage, aff, this);
    // get width and height / 2 to rotate from center of image
    aff.rotate(.01, MyImage.getWidth() / 2, MyImage.getHeight() / 2);
    MyImage is about 50px, 100px, and their is a point at 25px, 0px, which rotates with the rest of the image. What I'm asking is: is their anyway to keep track of that point while my image is rotating? It's a spaceship image that has a gun on it and I need to know where the gun is so I can make shooting animation.

    Let me know if you need more information.

    Thank you for reading,
    Nathan

  2. #2
    pbrockway2 is online now Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,573
    Rep Power
    12

    Default Re: java.awt.geometry - Rotating an Image with AffineTransform

    AffineTransform has a transform() method that will apply the transform to a given point.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: java.awt.geometry - Rotating an Image with AffineTransform

    Moving to Java 2D

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. java.awt.geometry - Rotating anImage with AffineTransform
    By natdizzle in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2012, 12:21 AM
  2. Help with Image Rotating?
    By Leospaceman in forum Java 2D
    Replies: 2
    Last Post: 05-31-2011, 03:48 PM
  3. Rotating Buffered Image distorts image
    By VortexSpin in forum Java 2D
    Replies: 1
    Last Post: 02-13-2011, 06:54 AM
  4. Rotating an image
    By lackofcolor in forum Java 2D
    Replies: 3
    Last Post: 02-28-2009, 12:54 AM
  5. Rotating Image?
    By sciguy77 in forum Java Applets
    Replies: 9
    Last Post: 02-17-2009, 02:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •