< prev index next >

test/java/awt/Graphics2D/Test8004859/Test8004859.java

Print this page


   1 /*
   2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Graphics2D;
  25 import java.awt.Rectangle;
  26 import java.awt.Shape;
  27 import java.awt.geom.NoninvertibleTransformException;
  28 import java.awt.image.BufferedImage;
  29 
  30 import sun.java2d.SunGraphics2D;
  31 
  32 /**
  33  * @test
  34  * @bug 8004859
  35  * @summary getClipBounds/getClip should return equivalent bounds.
  36  * @author Sergey Bylokhov


  37  */
  38 public final class Test8004859 {
  39 
  40     private static Shape[] clips = {new Rectangle(0, 0, -1, -1), new Rectangle(
  41             100, 100, -100, -100)};
  42 
  43     private static boolean status = true;
  44 
  45     public static void main(final String[] args)
  46             throws NoninvertibleTransformException {
  47         final BufferedImage bi = new BufferedImage(300, 300,
  48                                                    BufferedImage.TYPE_INT_RGB);
  49         final Graphics2D g = (Graphics2D) bi.getGraphics();
  50         test(g);
  51         g.translate(2.0, 2.0);
  52         test(g);
  53         g.translate(-4.0, -4.0);
  54         test(g);
  55         g.scale(2.0, 2.0);
  56         test(g);


   1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Graphics2D;
  25 import java.awt.Rectangle;
  26 import java.awt.Shape;
  27 import java.awt.geom.NoninvertibleTransformException;
  28 import java.awt.image.BufferedImage;
  29 
  30 import sun.java2d.SunGraphics2D;
  31 
  32 /**
  33  * @test
  34  * @bug 8004859
  35  * @summary getClipBounds/getClip should return equivalent bounds.
  36  * @author Sergey Bylokhov
  37  * @modules java.desktop/sun.java2d
  38  *          java.desktop/sun.java2d.pipe
  39  */
  40 public final class Test8004859 {
  41 
  42     private static Shape[] clips = {new Rectangle(0, 0, -1, -1), new Rectangle(
  43             100, 100, -100, -100)};
  44 
  45     private static boolean status = true;
  46 
  47     public static void main(final String[] args)
  48             throws NoninvertibleTransformException {
  49         final BufferedImage bi = new BufferedImage(300, 300,
  50                                                    BufferedImage.TYPE_INT_RGB);
  51         final Graphics2D g = (Graphics2D) bi.getGraphics();
  52         test(g);
  53         g.translate(2.0, 2.0);
  54         test(g);
  55         g.translate(-4.0, -4.0);
  56         test(g);
  57         g.scale(2.0, 2.0);
  58         test(g);


< prev index next >