-
Bug
-
Resolution: Unresolved
-
P3
-
8, 11, 17, 19, 20, 21
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When using the Graphics2D.draw function, the pixels drawn are getting changed depending on the fact whether the used paint is fully opaque (alpha = 255) or semi-transparent (alpha <255).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided code source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The resulting image "output.png" should not contain any red pixels.
ACTUAL -
The resulting image "output.png" does contain red pixels.
---------- BEGIN SOURCE ----------
package main.app;
import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Example {
public static void main(String[] args) throws IOException {
BufferedImage image = new BufferedImage(150, 50, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D graphics = image.createGraphics();
graphics.setPaint(Color.white);
graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
Ellipse2D.Double circle = new Ellipse2D.Double(10, 10, 30, 30);
Ellipse2D.Double ellipse = new Ellipse2D.Double(57, 12, 36, 26);
RoundRectangle2D.Double roundRectangle = new RoundRectangle2D.Double(110, 10, 30, 30, 20, 20);
graphics.setPaint(new Color(255, 0, 0 , 254));
graphics.draw(roundRectangle);
graphics.draw(circle);
graphics.draw(ellipse);
graphics.setPaint(new Color(0, 255, 0, 255));
graphics.draw(roundRectangle);
graphics.draw(circle);
graphics.draw(ellipse);
ImageIO.write(image, "png", new File("output.png"));
}
}
---------- END SOURCE ----------
FREQUENCY : always
When using the Graphics2D.draw function, the pixels drawn are getting changed depending on the fact whether the used paint is fully opaque (alpha = 255) or semi-transparent (alpha <255).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided code source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The resulting image "output.png" should not contain any red pixels.
ACTUAL -
The resulting image "output.png" does contain red pixels.
---------- BEGIN SOURCE ----------
package main.app;
import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Example {
public static void main(String[] args) throws IOException {
BufferedImage image = new BufferedImage(150, 50, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D graphics = image.createGraphics();
graphics.setPaint(Color.white);
graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
Ellipse2D.Double circle = new Ellipse2D.Double(10, 10, 30, 30);
Ellipse2D.Double ellipse = new Ellipse2D.Double(57, 12, 36, 26);
RoundRectangle2D.Double roundRectangle = new RoundRectangle2D.Double(110, 10, 30, 30, 20, 20);
graphics.setPaint(new Color(255, 0, 0 , 254));
graphics.draw(roundRectangle);
graphics.draw(circle);
graphics.draw(ellipse);
graphics.setPaint(new Color(0, 255, 0, 255));
graphics.draw(roundRectangle);
graphics.draw(circle);
graphics.draw(ellipse);
ImageIO.write(image, "png", new File("output.png"));
}
}
---------- END SOURCE ----------
FREQUENCY : always