< prev index next >

core/JemmyAWTInput/src/org/jemmy/image/awt/ResizeImageComparator.java

Print this page




   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. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package org.jemmy.image;
  26 
  27 import java.awt.Graphics2D;
  28 import java.awt.image.BufferedImage;
  29 import org.jemmy.Dimension;
  30 import org.jemmy.env.Environment;
  31 import org.jemmy.env.TestOut;
  32 import org.jemmy.image.pixel.Raster;
  33 import org.jemmy.image.pixel.RasterComparator;
  34 import org.jemmy.image.pixel.ResizeComparator;
  35 
  36 /**
  37  * Comparator that makes image sizes equal to compare them with other comparator
  38  * most of them work only for the images with equal dimensions.
  39  *
  40  * It is controlled by three parameters:
  41  * <p>
  42  * Resize Mode - defines way of resizing images that are being compared. One of the following constants:
  43  * <ul>
  44 *     <li>{@linkplain ResizeMode#NO_RESIZE NO_RESIZE},</li>
  45 *     <li>{@linkplain ResizeMode#PROPORTIONAL_RESIZE PROPORTIONAL_RESIZE},</li>
  46 *     <li>{@linkplain ResizeMode#ARBITRARY_RESIZE ARBITRARY_RESIZE}.</li>
  47  * </ul>
  48  *
  49  * Default value is {@linkplain ResizeMode#PROPORTIONAL_RESIZE}.
  50  * <ul>
  51  * <li>Resize Hint - defines the way of images scaling that is specified when
  52  * {@linkplain java.awt.Image#getScaledInstance(int, int, int) Image.getScaledInstance()} method is invoked.
  53  * One of the Image.SCALE_XXX is expected. Default value is {@linkplain java.awt.Image#SCALE_DEFAULT SCALE_DEFAULT}.</li>




   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. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package org.jemmy.image.awt;
  26 
  27 import java.awt.Graphics2D;
  28 import java.awt.image.BufferedImage;
  29 import org.jemmy.Dimension;
  30 import org.jemmy.env.Environment;
  31 import org.jemmy.env.TestOut;
  32 import org.jemmy.image.Image;
  33 import org.jemmy.image.ImageComparator;
  34 import org.jemmy.image.pixel.ResizeComparator;
  35 
  36 /**
  37  * Comparator that makes image sizes equal to compare them with other comparator
  38  * most of them work only for the images with equal dimensions.
  39  *
  40  * It is controlled by three parameters:
  41  * <p>
  42  * Resize Mode - defines way of resizing images that are being compared. One of the following constants:
  43  * <ul>
  44 *     <li>{@linkplain ResizeMode#NO_RESIZE NO_RESIZE},</li>
  45 *     <li>{@linkplain ResizeMode#PROPORTIONAL_RESIZE PROPORTIONAL_RESIZE},</li>
  46 *     <li>{@linkplain ResizeMode#ARBITRARY_RESIZE ARBITRARY_RESIZE}.</li>
  47  * </ul>
  48  *
  49  * Default value is {@linkplain ResizeMode#PROPORTIONAL_RESIZE}.
  50  * <ul>
  51  * <li>Resize Hint - defines the way of images scaling that is specified when
  52  * {@linkplain java.awt.Image#getScaledInstance(int, int, int) Image.getScaledInstance()} method is invoked.
  53  * One of the Image.SCALE_XXX is expected. Default value is {@linkplain java.awt.Image#SCALE_DEFAULT SCALE_DEFAULT}.</li>


< prev index next >