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

InnerShadow with offset > radius leaves an unshadowed band at the edge of the shape

XMLWordPrintable

      The following code demonstrates the bug in InnerShadow. If the shadow is offset so far that the blurred edge of the shadow becomes completely opaque then it should remain opaque all the way to the edge of the shape, but the effect ramps the shadow up to opaque, and then it ramps back down to transparent and there is a gap to the edge of the shape.

      import javafx.animation.Interpolator;
      import javafx.animation.Timeline;
      import javafx.scene.Scene;
      import javafx.scene.effect.*;
      import javafx.scene.paint.*;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      Stage {
          scene: Scene {
              fill: Color.WHITE
              width: 300
              height: 120
              content: [
                  Rectangle {
                      effect: InnerShadow { offsetX: 15 offsetY: 15 }
                      x: 100
                      y: 20
                      width: 50
                      height: 50
                      fill: Color.RED
                  }
                  Rectangle {
                      effect: InnerShadow { offsetX: -15 offsetY: -15 }
                      x: 200
                      y: 20
                      width: 50
                      height: 50
                      fill: Color.RED
                  }
              ]
          }
      }

        1. wrong.PNG
          wrong.PNG
          8 kB
        2. right.PNG
          right.PNG
          8 kB
        3. InnerShadowOffsetBug.fx
          0.8 kB

            flar Jim Graham
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: