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

REGRESSION: Indexed custom cursor with transparency displays incorrectly.

XMLWordPrintable

    • 2d
    • beta3
    • x86
    • windows_nt



      Name: nt126004 Date: 09/20/2001


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


      Transparent areas of a custom cursor are not transparent, but rather an XOR of
      the underlying color with the colour being used for the transparency. That is,
      if the image used for the custom cursor has an IndexColorModel which has its
      transparency specified as a single colour in the model, then any areas of the
      image painted with the "transparent" colour will instead be an XOR of the
      underlying screen and the "transparent" color.

      This does not occur on Linux (Linux works fine).

      The XORing happens with all areas of the screen, not just the Java areas.

      This behaviour does not happen with earlier versions of the JDK.

      Example code:

      import java.awt.*;
      import java.awt.image.*;

      public class IndexCursorSetTest extends Component {
          public static final void main(String[] args) {
              Frame f = new Frame();
              IndexCursorSetTest c = new IndexCursorSetTest();
              f.add(c);
              f.setSize(200, 200);
              f.show();
              c.setCursorOnComponent(f);
          }

          private static final byte[] indexImageData = new byte[] {
              2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,0,0,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
              2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
          };

          private static final IndexColorModel indexColorModel;
          private static final MemoryImageSource indexImageSource;
          static {
              byte[] blackWhite = new byte[] {
                  0x00, 0x00, 0x00,
                  (byte)0xff, (byte)0xff, (byte)0xff,
                  (byte)0xff, 0, 0,
              };
              indexColorModel = new IndexColorModel(2, 3, blackWhite, 0, false, 2);
              indexImageSource = new MemoryImageSource(32, 32, indexColorModel,
                                                       indexImageData, 0, 32);
          }

          private final Image pointerImage;

          private IndexCursorSetTest() {
              Toolkit t = getToolkit();
              pointerImage = t.createImage(indexImageSource);
              Cursor p = t.createCustomCursor(pointerImage, new Point(16, 14),
                                              "testCursor");
              setCursor(p);
          }

          private void setCursorOnComponent(Component c) {
              c.setCursor(getCursor());
          }
      }

      Release Regression From : 1.3.1

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

            flar Jim Graham
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: