JDK-4614845 : REGRESSION: SystemColor objects interact oddly with transparent GIFs
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-12-17
  • Updated: 2010-07-09
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b02Fixed
Related Reports
Relates :  
Relates :  
Description
Name: jk109818			Date: 12/17/2001


java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

I have a GIF that is mostly transparent that I draw onto a canvas with the
variation of 'Graphics.drawImage' that takes a background color. If that
background color is one of the system colors ('SystemColor.control', for
instance), black is drawn for all of the transparent pixels with JDK 1.4 beta
3. This worked fine before with 1.2 and 1.3.

Here is a simple application that demonstrates the problem:

import java.awt.*;

public class ColorBug extends Panel
{
    public static void main (String [] args)
    {
        transparentGIF = Toolkit.getDefaultToolkit ().getImage
("Transparent.gif");

        Frame f = new Frame ();
        ColorBug bug = new ColorBug ();
        bug.setBackground (Color.yellow);
        f.add (bug);
        f.setSize (200, 200);
        f.show ();
    }

    static Image transparentGIF;
    
    public void paint (Graphics g)
    {
        g.drawImage (transparentGIF, 0, 0, SystemColor.control, this);
        g.drawImage (transparentGIF, 0, 100, new Color
(SystemColor.control.getRGB ()), this);
    }
}

Notice that I'm drawing the transparent GIF twice. If I take the RGB value of
the system color and make a new color from it, the transparent pixels are drawn
correctly with 1.4. With 1.3, both versions of the image are drawn correctly.

"Transparent.gif" is available on request.

Release Regression From : 1.3
The above release value was the last known release where this 
bug was knwon to work. Since then there has been a regression.

(Review ID: 136037) 
======================================================================

Comments
SUGGESTED FIX http://sa.sfbay.sun.com/projects/java2d_data/7/4614845/
30-10-2007

EVALUATION Note that no changes were made to fix this bug - it was already fixed by the changes for 6389283, but a regression test was put back to b14 to verify that this particular manifestation of the bug does not reoccur...
14-06-2007

EVALUATION This now works in 1.7 due to changes in the way that the SystemColor object uses the "value" field in the parent Color class. It now stores the actual color there which interacts with other parts of the system much more compatibly. The changes to SystemColor were to fix bug 6389283: "SystemColor.createContext(..) - is it correct? is it needed?".
28-03-2007

EVALUATION Win32 specific.
06-12-2005

WORK AROUND Name: jk109818 Date: 12/17/2001 Create a new color from the RGB value of the system color. ======================================================================
17-09-2004

EVALUATION Please attach "Transparent.gif" to the bug. ###@###.### 2001-12-17
17-12-2001