/hg/gfx-test: Added two helper methods used to create test images.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Jan 7 02:42:46 PST 2013
changeset f58d79d0af5e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=f58d79d0af5e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jan 07 11:45:55 2013 +0100
Added two helper methods used to create test images.
Fixed names of two tests and removed one redundant test.
Added (c) year.
diffstat:
ChangeLog | 8 ++
src/org/gfxtest/framework/ImageFactory.java | 82 ++++++++++++++++++++++++
src/org/gfxtest/testsuites/BitBltBasicTests.java | 20 +-----
3 files changed, 92 insertions(+), 18 deletions(-)
diffs (149 lines):
diff -r c71e4eb14bec -r f58d79d0af5e ChangeLog
--- a/ChangeLog Fri Dec 21 10:35:45 2012 +0100
+++ b/ChangeLog Mon Jan 07 11:45:55 2013 +0100
@@ -1,3 +1,11 @@
+2013-01-07 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/framework/ImageFactory.java:
+ Added two helper methods used to create test images.
+ * src/org/gfxtest/testsuites/BitBltBasicTests.java:
+ Fixed names of two tests and removed one redundant test.
+ Added (c) year.
+
2012-12-21 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java:
diff -r c71e4eb14bec -r f58d79d0af5e src/org/gfxtest/framework/ImageFactory.java
--- a/src/org/gfxtest/framework/ImageFactory.java Fri Dec 21 10:35:45 2012 +0100
+++ b/src/org/gfxtest/framework/ImageFactory.java Mon Jan 07 11:45:55 2013 +0100
@@ -651,4 +651,86 @@
// return buffered image containing computed color pattern
return image;
}
+
+ /**
+ * Create image containing grayscale 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 createHorizontalGrayscaleGradientImage(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 << 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 grayscale 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 createVerticalGrayscaleGradientImage(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 << 8) | rgb;
+ image.setRGB(x, y, color);
+ }
+ }
+
+ // return buffered image containing computed color pattern
+ return image;
+ }
}
diff -r c71e4eb14bec -r f58d79d0af5e src/org/gfxtest/testsuites/BitBltBasicTests.java
--- a/src/org/gfxtest/testsuites/BitBltBasicTests.java Fri Dec 21 10:35:45 2012 +0100
+++ b/src/org/gfxtest/testsuites/BitBltBasicTests.java Mon Jan 07 11:45:55 2013 +0100
@@ -2075,7 +2075,7 @@
* graphics canvas
* @return test result status - PASSED, FAILED or ERROR
*/
- public TestResult testBitBltBWDotsImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
+ public TestResult testBitBltBWDotsBufferedImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
{
// create new buffered image and then perform basic BitBlt test.
return CommonBitmapOperations.doBitBltTestWithBWDotsImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY);
@@ -2256,7 +2256,7 @@
* graphics canvas
* @return test result status - PASSED, FAILED or ERROR
*/
- public TestResult testBitBltColorDotsImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
+ public TestResult testBitBltColorDotsBufferedImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
{
// create new buffered image and then perform basic BitBlt test.
return CommonBitmapOperations.doBitBltTestWithColorDotsImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY);
@@ -2428,22 +2428,6 @@
}
/**
- * Test basic BitBlt operation for color dots pattern buffered image
- * with type TYPE_BYTE_BINARY.
- *
- * @param image
- * image used as a destination for BitBlt-type operations
- * @param graphics2d
- * graphics canvas
- * @return test result status - PASSED, FAILED or ERROR
- */
- public TestResult testBitBltColorDotsImageTypeByteIntARGB(TestImage image, Graphics2D graphics2d)
- {
- // create new buffered image and then perform basic BitBlt test.
- return CommonBitmapOperations.doBitBltTestWithColorDotsImage(image, graphics2d, BufferedImage.TYPE_INT_ARGB);
- }
-
- /**
* Entry point to the test suite.
*
* @param args not used in this case
More information about the distro-pkg-dev
mailing list