/hg/gfx-test: Added helper methods into ImageFactory class.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Jan 22 00:46:46 PST 2013
changeset 29cdf3ddd67e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=29cdf3ddd67e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jan 22 09:49:31 2013 +0100
Added helper methods into ImageFactory class.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/framework/ImageFactory.java | 164 ++++++++++++++++++++++++++++
2 files changed, 169 insertions(+), 0 deletions(-)
diffs (186 lines):
diff -r 750235d0bf4c -r 29cdf3ddd67e ChangeLog
--- a/ChangeLog Mon Jan 21 09:49:53 2013 +0100
+++ b/ChangeLog Tue Jan 22 09:49:31 2013 +0100
@@ -1,3 +1,8 @@
+2013-01-22 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/framework/ImageFactory.java:
+ Added helper methods into ImageFactory class.
+
2013-01-21 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java:
diff -r 750235d0bf4c -r 29cdf3ddd67e src/org/gfxtest/framework/ImageFactory.java
--- a/src/org/gfxtest/framework/ImageFactory.java Mon Jan 21 09:49:53 2013 +0100
+++ b/src/org/gfxtest/framework/ImageFactory.java Tue Jan 22 09:49:31 2013 +0100
@@ -817,6 +817,170 @@
}
/**
+ * Create image containing green 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 createHorizontalGreenGradientImage(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);
+ // 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 green 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 createVerticalGreenGradientImage(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);
+ image.setRGB(x, y, color);
+ }
+ }
+
+ // return buffered image containing computed color pattern
+ return image;
+ }
+
+ /**
+ * Create image containing blue 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 createHorizontalBlueGradientImage(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);
+ // 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 blue 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 createVerticalBlueGradientImage(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);
+ 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