Permalink
Browse files

GraphicsUtils.getAlphaImage() returns white image for opaque input wi…

…th bitmask alpha.
  • Loading branch information...
eseifert committed Aug 19, 2017
1 parent 095996f commit 0d5572397f56803eaecd0b2861fde323c4587b51
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/test/java/de/erichseifert/vectorgraphics2d/util/GraphicsUtilsTest.java
@@ -471,10 +471,27 @@ public void getAlphaImageReturnsBlackImageForTransparentInputWithBitmaskAlpha()
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
GraphicsConfiguration config = device.getDefaultConfiguration();
BufferedImage image = config.createCompatibleImage(TEST_IMAGE_WIDTH, TEST_IMAGE_HEIGHT, Transparency.BITMASK);
BufferedImage image = config.createCompatibleImage(
TEST_IMAGE_WIDTH, TEST_IMAGE_HEIGHT, Transparency.BITMASK);
BufferedImage result = GraphicsUtils.getAlphaImage(image);
assertBufferedImageContentEquals(blackGrayscaleImage, result);
}
@Test
public void getAlphaImageReturnsWhiteImageForOpaqueInputWithBitmaskAlpha() {
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
GraphicsConfiguration config = device.getDefaultConfiguration();
BufferedImage image = config.createCompatibleImage(
TEST_IMAGE_WIDTH, TEST_IMAGE_HEIGHT, Transparency.BITMASK);
Graphics g = image.getGraphics();
g.setColor(Color.RED);
g.fillRect(0, 0, TEST_IMAGE_WIDTH, TEST_IMAGE_HEIGHT);
BufferedImage result = GraphicsUtils.getAlphaImage(image);
assertBufferedImageContentEquals(whiteGrayscaleImage, result);
}
}

0 comments on commit 0d55723

Please sign in to comment.