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

fx LinearGradient not aligned with awt LinearGradientPaint

    XMLWordPrintable

    Details

      Description

      Try the attached program, that simply add a rectangle with 2 stops with identical offset : 1.
      With Prism d3d, the rectangle is white, fine.
      But with Prism j2d, we get the exception below. The 2 APIs should be aligned to avoid this kind of issue.

      We have this issue in VT (aka Scene Builder), when one does not have a Prism d3d capable hardware, or when the graphic driver version is not the right one (FYI it happens an an Oracle standard laptop delivered ~6 months ago).

      java.lang.IllegalArgumentException: User must specify at least 2 colors
          at java.awt.MultipleGradientPaint.<init>(MultipleGradientPaint.java:151)
          at java.awt.LinearGradientPaint.<init>(LinearGradientPaint.java:262)
          at java.awt.LinearGradientPaint.<init>(LinearGradientPaint.java:221)
          at com.sun.prism.j2d.J2DPrismGraphics.toJ2DPaint(J2DPrismGraphics.java:214)
          at com.sun.prism.j2d.J2DPrismGraphics.fill(J2DPrismGraphics.java:661)
          at com.sun.prism.j2d.J2DPrismGraphics.fill(J2DPrismGraphics.java:667)
          at com.sun.prism.impl.shape.BasicShapeRep.fill(BasicShapeRep.java:26)
          at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:133)
          at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:188)
          at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:42)
          at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1131)
          at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:205)
          at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:188)
          at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:42)
          at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1131)
          at com.sun.javafx.tk.quantum.PaintRunnable.doPaint(PaintRunnable.java:217)
          at com.sun.javafx.tk.quantum.PaintRunnable.paintImpl(PaintRunnable.java:154)
          at com.sun.javafx.tk.quantum.PaintRunnable.run(PaintRunnable.java:329)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
          at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
          at com.sun.prism.render.RenderJob.run(RenderJob.java:29)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at com.sun.javafx.tk.quantum.QuantumRenderer$ObservedRunnable.run(QuantumRenderer.java:67)
          at java.lang.Thread.run(Thread.java:662)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              flar Jim Graham
              Reporter:
              jcambon Jerome Cambon
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: