Duplicate :
|
Name: jk109818 Date: 12/17/2002 FULL PRODUCT VERSION : Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21) Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode) FULL OPERATING SYSTEM VERSION : glibc-2.2.5-42 Linux animal 2.4.18-5 #1 Mon Jun 10 15:31:48 EDT 2002 i686 Red Hat Linux release 7.3 (Valhalla) ADDITIONAL OPERATING SYSTEMS : EXTRA RELEVANT SYSTEM CONFIGURATION : screen #0: dimensions: 1280x1024 pixels (361x271 millimeters) resolution: 90x96 dots per inch depths (7): 16, 1, 4, 8, 15, 24, 32 depth of root window: 16 planes number of colormaps: minimum 1, maximum 1 default colormap: 0x20 default number of colormap cells: 64 preallocated pixels: black 0, white 65535 options: backing-store NO, save-unders NO largest cursor: 64x64 visual: visual id: 0x23 class: TrueColor depth: 16 planes available colormap entries: 64 per subfield red, green, blue masks: 0xf800, 0x7e0, 0x1f significant bits in color specification: 8 bits A DESCRIPTION OF THE PROBLEM : When drawing a rotated BufferedImage using Graphics2D tranformation mechanism, the colors are wrong on Linux. The exact same code works flawlessly an Solaris and MacOS X systems.This bug is present in JDK 1.4.0 as well. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Run the code example below EXPECTED VERSUS ACTUAL BEHAVIOR : I expect to see the image specified on the command line displayed twice; once with no rotation, and one rotated by 90 degrees. The rotation works, but the rotated image is displayed in incorrect colors. On Solaris (Sparc) and MacOS X the code works as expected. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.*; import java.awt.*; import java.awt.event.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.image.*; import javax.swing.*; import java.io.*; public class Test extends JFrame { int mWidth, mHeight; BufferedImage mImage; public Test(File file) { setSize(320, 200); ImageIcon icon = new ImageIcon(file.getPath()); Image image = icon.getImage(); if (image.getWidth(this) >= image.getHeight(this)) { mWidth = 80; mHeight = 80 * image.getHeight(this) / image.getWidth(this); } else { mWidth = 80 * image.getWidth(this) / image.getHeight(this); mHeight = 80; } mImage = new BufferedImage(mWidth, mHeight, BufferedImage.TYPE_USHORT_555_RGB); Graphics2D gfx = mImage.createGraphics(); gfx.drawImage(image, 0, 0, mWidth, mHeight, null); validate(); setVisible(true); } public void paint(Graphics g) { super.paint(g); Graphics2D gfx = (Graphics2D)g; gfx.drawImage(mImage, (100 - mWidth) / 2, (80 - mHeight) / 2, this); gfx.transform(AffineTransform.getRotateInstance(Math.PI / 2)); gfx.drawImage(mImage, (80 - mWidth) / 2, (100 - mHeight) / 2 - 200, this); } public static void main(String args[]) { File file; if (args.length != 0) { file = new File(args[0]); Test app = new Test(file); } } } ---------- END SOURCE ---------- Release Regression From : 1.3.1_06 The above release value was the last known release where this bug was known to work. Since then there has been a regression. (Review ID: 178466) ======================================================================