snapshot throws IllegalArgumentException if scene or node bounds is empty

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 7u6
    • Affects Version/s: 7u6
    • Component/s: 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)

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

              Created:
              Updated:
              Resolved:
              Imported: