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

StrokeType.OUTER is not well defined for unclosed shapes and paths

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:

      Description

      Arc seems unable to draw an ordinary mathematical arc. As the attached image shows, Arc draws some strange end caps even when StrokeLineCap.BUTT and ArcType.OPEN is chosen.

      This affects the latest JavaFX8 shipped with Java 8.

      Code excerpt:


      arc = new Arc();
      arc.setType(ArcType.OPEN);
      arc.setStartAngle(0);
      arc.setLength(0);

      timeline = new Timeline(
      new KeyFrame(
      Duration.ZERO,
      new KeyValue(arc.startAngleProperty(), 90),
      new KeyValue(arc.lengthProperty(), 0)
      ),
      new KeyFrame(
      Duration.millis(2000),
      new KeyValue(arc.startAngleProperty(), 90),
      new KeyValue(arc.lengthProperty(), -360)
      ),
      new KeyFrame(
      Duration.millis(4000),
      new KeyValue(arc.startAngleProperty(), -270),
      new KeyValue(arc.lengthProperty(), 0)
      )
      );
      timeline.setCycleCount(Timeline.INDEFINITE);

      double size = 48;
      double strokeWidth = 4;
      double radius = size / 2 - strokeWidth;

      arc.setCenterX(radius);
      arc.setCenterY(radius);
      arc.setRadiusX(radius);
      arc.setRadiusY(radius);

      arc.setFill(null);
      arc.setStroke(new Color(1.0, 1.0, 1.0, 0.9));
      arc.setStrokeType(StrokeType.OUTSIDE);
      arc.setStrokeWidth(strokeWidth);
      arc.setStrokeLineCap(StrokeLineCap.BUTT);

      NodeUtility.setOnlySize(this, radius * 2);

        Attachments

          Activity

            People

            Assignee:
            flar Jim Graham
            Reporter:
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: