/hg/gfx-test: Added four new helper methods into ImageFactory cl...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Jan 28 00:51:48 PST 2013


changeset 3463abbeeca5 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=3463abbeeca5
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jan 28 09:54:49 2013 +0100

	Added four new helper methods into ImageFactory class.


diffstat:

 ChangeLog                                   |    5 +
 src/org/gfxtest/framework/ImageFactory.java |  163 ++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+), 0 deletions(-)

diffs (185 lines):

diff -r dcf8661a53c2 -r 3463abbeeca5 ChangeLog
--- a/ChangeLog	Fri Jan 25 10:42:12 2013 +0100
+++ b/ChangeLog	Mon Jan 28 09:54:49 2013 +0100
@@ -1,3 +1,8 @@
+2013-01-28  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/ImageFactory.java:
+	Added four new helper methods into ImageFactory class.
+
 2013-01-25  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/CommonBitmapOperations.java:
diff -r dcf8661a53c2 -r 3463abbeeca5 src/org/gfxtest/framework/ImageFactory.java
--- a/src/org/gfxtest/framework/ImageFactory.java	Fri Jan 25 10:42:12 2013 +0100
+++ b/src/org/gfxtest/framework/ImageFactory.java	Mon Jan 28 09:54:49 2013 +0100
@@ -981,6 +981,169 @@
     }
 
     /**
+     * Create image containing magenta gradient.
+     * 
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
+    public static BufferedImage createHorizontalMagentaGradientImage(int width, int height, int imageType)
+    {
+        // check for proper image dimensions
+        if (width <= 0 || height <= 0)
+        {
+            return null;
+        }
+
+        // create new image
+        BufferedImage image = new BufferedImage(width, height, imageType);
+
+        // for all lines in a raster image
+        for (int y = 0; y < height; y++)
+        {
+            // compute color for each pixel
+            int rgb = (int) Math.round(y * 256.0 / height);
+            if (rgb < 0) rgb = 0;
+            if (rgb > 255) rgb = 255;
+            int color = (0xff << 24) | (rgb << 16) | (rgb);
+            // for all columns on a line
+            for (int x = 0; x < width; x++)
+            {
+                image.setRGB(x, y, color);
+            }
+        }
+
+        // return buffered image containing computed color pattern
+        return image;
+    }
+
+    /**
+     * Create image containing magenta gradient.
+     * 
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
+    public static BufferedImage createVerticalMagentaGradientImage(int width, int height, int imageType)
+    {
+        // check for proper image dimensions
+        if (width <= 0 || height <= 0)
+        {
+            return null;
+        }
+
+        // create new image
+        BufferedImage image = new BufferedImage(width, height, imageType);
+
+        // for all lines in a raster image
+        for (int y = 0; y < height; y++)
+        {
+            // for all columns on a line
+            for (int x = 0; x < width; x++)
+            {
+                // compute color for each pixel
+                int rgb = (int) Math.round(x * 256.0 / width);
+                if (rgb < 0) rgb = 0;
+                if (rgb > 255) rgb = 255;
+                int color = (0xff << 24) | (rgb << 16) | (rgb);
+                image.setRGB(x, y, color);
+            }
+        }
+
+        // return buffered image containing computed color pattern
+        return image;
+    }
+
+    /**
+     * Create image containing cyan gradient.
+     * 
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
+    public static BufferedImage createHorizontalCyanGradientImage(int width, int height, int imageType)
+    {
+        // check for proper image dimensions
+        if (width <= 0 || height <= 0)
+        {
+            return null;
+        }
+
+        // create new image
+        BufferedImage image = new BufferedImage(width, height, imageType);
+
+        // for all lines in a raster image
+        for (int y = 0; y < height; y++)
+        {
+            // compute color for each pixel
+            int rgb = (int) Math.round(y * 256.0 / height);
+            if (rgb < 0) rgb = 0;
+            if (rgb > 255) rgb = 255;
+            int color = (0xff << 24) | (rgb << 8) | (rgb);
+            // for all columns on a line
+            for (int x = 0; x < width; x++)
+            {
+                image.setRGB(x, y, color);
+            }
+        }
+
+        // return buffered image containing computed color pattern
+        return image;
+    }
+
+    /**
+     * Create image containing cyan gradient.
+     * 
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
+    public static BufferedImage createVerticalCyanGradientImage(int width, int height, int imageType)
+    {
+        // check for proper image dimensions
+        if (width <= 0 || height <= 0)
+        {
+            return null;
+        }
+
+        // create new image
+        BufferedImage image = new BufferedImage(width, height, imageType);
+
+        // for all lines in a raster image
+        for (int y = 0; y < height; y++)
+        {
+            // for all columns on a line
+            for (int x = 0; x < width; x++)
+            {
+                // compute color for each pixel
+                int rgb = (int) Math.round(x * 256.0 / width);
+                if (rgb < 0) rgb = 0;
+                if (rgb > 255) rgb = 255;
+                int color = (0xff << 24) | (rgb << 8) | (rgb);
+                image.setRGB(x, y, color);
+            }
+        }
+
+        // return buffered image containing computed color pattern
+        return image;
+    }
+    /**
      * Create image containing red to blue gradient.
      * 
      * @param width



More information about the distro-pkg-dev mailing list