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

GraphicsConfiguration.createCompatibleImage doc should contain Exception

XMLWordPrintable

    • 2d
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      GraphicsConfiguration.createCompatibleImage will throw RasterFormatException: negative width for 0 width, which is not shown in doc.


      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.image.BufferedImage;

      public class HeadlessGraphicsConfiguration {
          public static void main(String args[]) {
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              BufferedImage sourceImage = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR);
              Graphics2D gd = ge.createGraphics(sourceImage);
              GraphicsConfiguration gc = gd.getDeviceConfiguration();
              
              BufferedImage bi3 = gc.createCompatibleImage(0, 0);
          }
      }
      ---------- END SOURCE ----------

            jdv Jayathirth D V
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: