Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4071240

Rotated image bounds contains distorted previously drawn image

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 1.2.0
    • 1.2.0
    • client-libs
    • None
    • 2d
    • 1.2beta
    • 1.2beta
    • sparc
    • solaris_2.5.1
    • Verified

    Description

      Drawing a translated scaled image, then drawing a translated rotated image. The translated rotated image is drawn, but inside the bounds of this image contains a distorted look of the previously drawn translated scaled image.

      import java.awt.*;
      import java.awt.geom.AffineTransform;

      public class test extends Canvas
      {
          Image img1, img2;

          public test()
          {
              setBackground(Color.white);

              img1 = getToolkit().getImage("image3.gif");
              img2 = getToolkit().getImage("image4.gif");
          }

          public void paint(Graphics g)
          {
              Graphics2D g2 = (Graphics2D) g;

              int x = getSize().width;
              int y = getSize().height;

              AffineTransform at = new AffineTransform();
              at.translate( 10.0, 10.0);
              at.scale(1, 2);
              g2.drawImage(img1, at, this);

              at = new AffineTransform();
              at.translate( 200, 10);
              at.rotate((45*java.lang.Math.PI)/180);
              g2.drawImage(img2, at, this);
         }

          public static void main(String s[])
          {
              Frame f = new Frame("Java 2D Test Product");
              f.setSize(new Dimension(800,600));
              f.add("Center", new test());
              f.pack();
              f.show();
          }
      }

      Attachments

        Activity

          People

            jehung Jeannette Hung
            blichtensunw Brian Lichtenwalter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: