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

Cannot draw into BufferedImage of TYPE_BYTE_BINARY using Graphics2D

XMLWordPrintable

    • 2d
    • beta3
    • sparc
    • solaris_7

      When BufferedImage of type TYPE_BYTE_BINARY is created and Graphics2D is obtained from the image, drawing shapes into it by calling fill method doesn't change any of the bits in the buffer. This doesn't happen when JDK 1.3.1 or JDK 1.3 is used. Please try the following to recreate:

          Shape s2 = new Rectangle(0, 0, 5, 5);
          BufferedImage bi = new BufferedImage(5, 5,
                                  BufferedImage.TYPE_BYTE_BINARY);
          Graphics2D g2d = bi.createGraphics();
          g2d.fill(s2);
          int[] pixels0 = bi.getData().getPixels(0, 0, 5, 5, (int[])null);
          for (int i = 0; i < pixels0.length; i++)
            System.out.println(pixels0[i]);

      dongkyu% /net/java3d/export/jdk_1.4/Release/latest/solsparc/bin/java -version
      java version "1.4.0-beta_refresh"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b71)
      Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b71, mixed mode)

      Happens on Solaris 7, 8, 9.

            flar Jim Graham
            dongkyle Dongkyu Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: