Results 1 to 3 of 3
  1. #1
    robocop is offline Member
    Join Date
    Feb 2009
    Rep Power

    Cool [SOLVED] AffineTransform

    Hello all,
    I'm back with another problem. I cannot get the following method to compile. Can you help?

    Java Code:
    public Picture shear(double xFactor, double yFactor) 
            // set up the shear transform
            AffineTransform shearTransform = new AffineTransform();
            Rectangle2D rect = getTranslationEnclosingRectangle(shearTransform);
            /* create a new picture object big enough to hold the
             * result
            Picture result = new Picture (
                                          (int) (Math.ceil(rect.getWidth())),
                                          (int) (Math.ceil(rect.getHeight())));
                // get the graphics 2D object from the result
            Graphics graphics = result.getGraphics();
            Graphics2D g2 = (Graphics2D) graphics;
            /* save the current transformation and set up to
             * center the new image
            AffineTransform savedTrans = g2.getTransform();
            AffineTransform centerTrans = new AffineTransform();
            centerTrans.translate(0 - rect.getX(), 0 - rect.getY());
            // draw the current MH onto the result image sheared
            //  g reason that2 transformation to the saved one
            return result;
        } //end of shear method

    The error message in the interactions pane is:
    Error: C:\Users\Jim\Documents\Heidelberg\Spring2009\myjav a\cps201\ cannot find symbol
    symbol : method getTranslationEnclosingRectangle(java.awt.geom.Aff ineTransform)
    location: class Picture

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    Your compiler is saying it cannot find a method in the Picture class with the following signature:
    Java Code:
    Rectangle2D getTranslationEnclosingRectangle(AffineTransform at)

  3. #3
    robocop is offline Member
    Join Date
    Feb 2009
    Rep Power

    Default AffineTransform

    Thanks for replying hardwired. The problem actually lies in an error. The line was supposed th read:

    Java Code:
    Rectangle2D rect = getTransformEnclosingRectangle(shearTransform);
    instead of:
    Java Code:
    Rectangle2D rect = getTranslationEnclosingRectangle(shearTransform);

Similar Threads

  1. AffineTransform help
    By tones in forum New To Java
    Replies: 4
    Last Post: 12-19-2008, 08:24 AM
  2. AffineTransform demo
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:59 PM
  3. affineTransform rotation
    By MichYer in forum AWT / Swing
    Replies: 0
    Last Post: 07-18-2007, 09:55 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