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

snapshot throws IllegalArgumentException if scene or node bounds is empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7u6
    • 7u6
    • javafx

      The following code which takes a snapshot of an empty scene will throw an exception. A similar exception is thrown for a node with an empty bounds.

          Scene s = new Scene(new Group());
          s.snapshot(null);

      Image dimensions must be > 0
      java.lang.IllegalArgumentException: Image dimensions must be > 0
              at com.sun.prism.Image.<init>(Image.java:135)
              at com.sun.prism.Image.<init>(Image.java:118)
              at com.sun.prism.Image.fromByteBgraPreData(Image.java:44)
              at com.sun.javafx.tk.quantum.QuantumToolkit.createPlatformImage(QuantumToolkit.java:1312)
              at javafx.scene.image.Image.<init>(Image.java:662)
              at javafx.scene.image.WritableImage.<init>(WritableImage.java:70)
              at javafx.scene.Scene.doSnapshot(Scene.java:1110)
              at javafx.scene.Scene.doSnapshot(Scene.java:1167)
              at javafx.scene.Scene.snapshot(Scene.java:1237)

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: