Results 1 to 6 of 6
  1. #1
    sgthale is offline Member
    Join Date
    Apr 2011
    Posts
    48
    Rep Power
    0

    Red face Quick rotating images question

    im trying to make an image rotate around a point but i dont know how to do it because when i try to do this:

    t = some AffineTransformation


    t.translate(Math.round(bone.getBoneX()), Math.round(bone.getBoneY()));
    t.rotate(bone.getBoneRotation());
    g2.drawImage(img,t,this);

    i get my rotated image but it rotates around its (0,0) corner point and i need help knowing how to fix this.

  2. #2
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    Look into the AffineTransform methods:
    AffineTransform (Java Platform SE 6)

    Look for the multiple overloaded methods of rotate().

  3. #3
    sgthale is offline Member
    Join Date
    Apr 2011
    Posts
    48
    Rep Power
    0

    Default re

    that kind of helped but i still dont know how to implement it. For example, i want my image to rotate say at (5,5) from the left top corner of the image

  4. #4
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    Then you would do translate(5,5) then rotate(angle).

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by sgthale View Post
    that kind of helped but i still dont know how to implement it. For example, i want my image to rotate say at (5,5) from the left top corner of the image
    As already mentioned, there is an overload of AffineTransform.getRotateInstance(...) that takes three double parameters, an angle and the x and y center of rotation. If you've tried this and it fails, at this point you should show us your code because otherwise there's no way for anyone to guess what you're doing wrong.

  6. #6
    sgthale is offline Member
    Join Date
    Apr 2011
    Posts
    48
    Rep Power
    0

Similar Threads

  1. quick question
    By biggerthanblue in forum New To Java
    Replies: 2
    Last Post: 04-10-2011, 04:33 AM
  2. Really Quick question
    By Ryan10 in forum New To Java
    Replies: 63
    Last Post: 03-02-2011, 02:11 AM
  3. Quick question
    By sAntA199 in forum New To Java
    Replies: 2
    Last Post: 12-09-2009, 03:01 AM
  4. Rotating Images
    By Unome in forum Java Applets
    Replies: 3
    Last Post: 03-30-2009, 04:55 PM
  5. One last quick question
    By jigglywiggly in forum New To Java
    Replies: 7
    Last Post: 01-26-2009, 08:53 AM

Tags for this Thread

Posting Permissions

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