Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4614845

REGRESSION: SystemColor objects interact oddly with transparent GIFs

XMLWordPrintable

    • b02
    • x86
    • windows_2000
    • Verified

      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)
      ======================================================================

            flar Jim Graham
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: