Results 1 to 4 of 4

Thread: AffineTransform

  1. #1
    Guy
    Guy is offline Member
    Join Date
    Jul 2011
    Posts
    42
    Rep Power
    0

    Default AffineTransform

    Hey, I've been experimenting with rotating and scaling BufferedImages with the affineTransform, but I wasn't sure how to do both a scale and rotation at the same time.
    This is an extract of my code:
    Java Code:
    collisionObjAt = new AffineTransform();	
    collisionObjAt.setToScale(size, size);
    collisionObjAt.setToRotation(theta);
    collisionObjTransform = new AffineTransformOp(collisionObjAt, AffineTransformOp.TYPE_BILINEAR);
    At the moment it seems to be ignoring the first thing (scale) and only applying the second (rotation). How do I get it to do both?
    Thanks :)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: AffineTransform

    Moved from New to Java

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

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: AffineTransform

    Quote Originally Posted by Guy View Post
    At the moment it seems to be ignoring the first thing (scale) and only applying the second (rotation).
    That's what set... methods usually do.

    Quote Originally Posted by Guy View Post
    How do I get it to do both?
    Read the API for AffineTransform. Do you see any methods that transform the AT without setting its transform?

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

  4. #4
    Guy
    Guy is offline Member
    Join Date
    Jul 2011
    Posts
    42
    Rep Power
    0

    Default Re: AffineTransform

    That's what set... methods usually do.
    Thanks lol, I didn't know that. Using rotate and scale worked perfectly.

Similar Threads

  1. Problem with AffineTransform
    By pradeep.badam in forum AWT / Swing
    Replies: 0
    Last Post: 01-06-2010, 09:06 AM
  2. JScrollPane and AffineTransform
    By JReacher in forum New To Java
    Replies: 0
    Last Post: 12-17-2009, 02:47 PM
  3. [SOLVED] AffineTransform
    By robocop in forum New To Java
    Replies: 2
    Last Post: 03-25-2009, 05:54 PM
  4. AffineTransform help
    By tones in forum New To Java
    Replies: 4
    Last Post: 12-19-2008, 07:24 AM
  5. affineTransform rotation
    By MichYer in forum AWT / Swing
    Replies: 0
    Last Post: 07-18-2007, 08:55 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
  •